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:
Public Function GetData() As ADODB.Recordset Dim strsql As String ' Dim r As ADODB.Recordset ' Dim c As ADODB.Connection Dim multipledate raised = FrmInvoice.StatusBar1.Panels(3).Text multipledate = Date Set c = New ADODB.Connection c.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=.\Invoice.mdb;" c.Open strsql = "SELECT * from Invoice WHERE RaisedBy = '" & raised & "' AND [Date] = '" & multipledate & "' " 'strsql = strsql & "WHERE Raisedby = '" & raised & "' " 'Set rsquery = New ADODB.Recordset rsquery.Open strsql, c, adOpenDynamic, adLockPessimistic Set GetData = rsquery End Function




Reply With Quote