I am attempting to check my EmDpsst field in my access2003 database. I am attempting to check all the dates in the field, EmDpsst and see if they are less than 90 days. If so I plan to report them to a txtDpsst.
So far I have the following code:
Only my problem is that it is not working lol. Any ideas how I am able to properly adjust my coding?Code:Private Sub CallCheck2() Dim strSQL As String Dim cn As ADODB.Connection Set cn = New ADODB.Connection Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset cn.ConnectionString = GetConnString Dim days As Long Dim Expired As String strSQL = "SELECT EmLast, EmDpsst FROM tblEmployee Group BY EmDpsst" cn.Open rs.Open strSQL, cn, adOpenStatic, adLockOptimistic days = DateDiff("d", Now, EmDpsst) If rs.RecordCount > 0 Then Do Until rs.EOF If rs.Fields(EmDpsst) = days < 90 Then txtDpsst.Text = "Name: " & rs.Fields(EmLast) & " Expiring: " & rs.Fields(EmDpsst) & vbCrLf & txtDpsst.Text End If rs.MoveNext Loop End If rs.Close End Sub
Much appreciated,
Azeccia




Reply With Quote