Private Sub ComboDate_AfterUpdate()
Dim qdf as QueryDef, strSQL as String
Set qdf=CurrentDB().QueryDefs("query name")
strSQL="SELECT * FROM [table name] WHERE [date field]=#" _
& Me!ComboDate & "#"
qdf.SQL=strSQL
End Sub
This code successfully changes the SQL of the query. But when I try to run the query, that mismatch message pops up.
Sometime it works and sometime it doesn't. It seams that it didn't work when [date field] contained NULL value. Any advice?
Dim qdf as QueryDef, strSQL as String
Set qdf=CurrentDB().QueryDefs("query name")
strSQL="SELECT * FROM [table name] WHERE [date field]=#" _
& Me!ComboDate & "#"
qdf.SQL=strSQL
End Sub
This code successfully changes the SQL of the query. But when I try to run the query, that mismatch message pops up.
Sometime it works and sometime it doesn't. It seams that it didn't work when [date field] contained NULL value. Any advice?