Hi everyone,
I wrote the below codes to filter subform by date and product code, this work correct, but I want to add nz to date for get all the dates.
I added Nz function to querydate :
But it doesn't work and returns runtime error '3075'. can someone give me a way to ignore "querydate" or select all dates when it will be null?
I wrote the below codes to filter subform by date and product code, this work correct, but I want to add nz to date for get all the dates.
Code:
querydate = "[CDate] = #" & Me.txtDate & "# "
If Me.cmb01.ListIndex = 0 Then
pSQL = "select * from tblProducts where " & querydate & ""
ElseIf Me.cmb01.ListIndex = 1 Then
pSQL = "select * from tblProducts where " & querydate & " and Ccode = 6"
ElseIf Me.cmb01.ListIndex = 2 Then
pSQL = "select * from tblProducts where " & querydate & " Ccode = 4"
End if
Me.Child44.Form.RecordSource = pSQL
I added Nz function to querydate :
Code:
querydate = "[CDate] = #" & nz(Me.txtDate,"*") & "# "