My aim is to select all invoices done by a certain user and done 'today' using system date.

In my sql statement, when i use the date it returns nothing. When i remove the date section of the statement it works fine BUT selects everything.


VB Code:
  1. Public Function GetData() As ADODB.Recordset
  2.    Dim strsql As String
  3.    ' Dim r As ADODB.Recordset '
  4.    Dim c As ADODB.Connection
  5.    Dim multipledate
  6.     raised = FrmInvoice.StatusBar1.Panels(3).Text
  7.   multipledate = Date
  8.    Set c = New ADODB.Connection
  9.    c.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=.\Invoice.mdb;"
  10.    c.Open
  11.  
  12.    strsql = "SELECT * from Invoice WHERE RaisedBy = '" & raised & "' AND [Date] = '" & multipledate & "' "
  13.    'strsql = strsql & "WHERE Raisedby = '" & raised & "' "
  14.    'Set rsquery = New ADODB.Recordset
  15.    
  16.    
  17.       rsquery.Open strsql, c, adOpenDynamic, adLockPessimistic
  18.  
  19.    Set GetData = rsquery
  20. End Function