date variables sql

exaccess

Registered User.
Local time
Today, 01:43
Joined
Apr 21, 2013
Messages
287
Hi,
Could please anyone tell me what is wrong with the code below?
Code:
If Not IsNull(F03) Then sWhere = sWhere & " and " & F03 >= " & " 'Format(V03, ''#dd/mm/yyyy#'')'" & Chr(13)
It says missing operator.
F03 is date variable and v03 is a date value.
Thanks.
 
If Not IsNull(F03) Then sWhere = sWhere & " and [v03] <= #" & Format(F03,"mm\/dd\/yyyy") & "#"
 
If Not IsNull(F03) Then sWhere = sWhere & " and [v03] <= #" & Format(F03,"mm\/dd\/yyyy") & "#"

Hello thanks for the response. But it does not work. It says missing operator. Also additional info the date field name is obtained from a combobox which changes with every query. I need to display the actual query sql each time. This is educational software.
 
sorry about that, so which variable holds the date fieldname, F03 or V03?
 
Re: date variables sql SOLVED

Sorry for late response. I am on multiple projects. In the meantime I found the solution. Posted below. The code is inserted in a module for other forms to call when necessary:

Code:
If Not IsNull(Forms(ForName).F04) Then sWhere = sWhere & " and " & Forms(ForName).F04 & " <= #" & Forms(ForName).V04 & "#"
 

Users who are viewing this thread

Back
Top Bottom