Help with Unbound Date field to link with SQL VBA
I am busy setting up a find/filter and sort feature for a table that will have a lot of data, in three months up to 2500 entries. I have used the SQL functions as described from page 420 in the Book. Of the nine filter field I have 8 are working with out a problem. In the main table (ACCOUNTS) I have a field called TRADATE set as Short Date. In the Filter query the same field exits. In the form I have an Unbound txtTID field set to short date format. The VBA and Sql is modified form page 422-427.
I have tried using the code for strings and for numerics but i have had no luck i keep getting an empty table as my result.
the code attached to the after update field is as follows
Private Sub txtTID_AfterUpdate()
On Error GoTo Error_Handler
SelectRecords
txtTID.Requery
Exit_Procedure:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "An error has occurred in this application. " _
& "Please contact your technical support person and tell them this information:" _
& vbCrLf & vbCrLf & "Error Number " & Err.NUMBER & ", " & Err.DESCRIPTION, _
Buttons:=vbCritical, title:="My Application"
Resume Exit_Procedure
Resume
End Sub
the code attached to the selectrecords function is as follows
If Not IsNull(txtTID) Then
varWhereClause = (varWhereClause + strAND) & _
"qryFilterLedgerExpenses.TRADATE = " & Me!txtTID
End If
I thinks there is something wrong with my syntax so any help would be appreciated
In the VBA watch window I found that the date ends up with a " mark and hence no data is found.
|