Results 1 to 6 of 6

Thread: [RESOLVED] SQL concerns...

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    79

    Resolved [RESOLVED] SQL concerns...

    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:

    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
    Only my problem is that it is not working lol. Any ideas how I am able to properly adjust my coding?


    Much appreciated,
    Azeccia
    Last edited by Azeccia; Apr 5th, 2008 at 11:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width