10 replies
How are you doing this?
Filters? Queries? in code?
And have you looked at the resulting sql string if it's a query/code?
by john_wills
by john_wills
by sl-campbell
It would help to see then complete criteria string, or better yet, put a debug.print on the criteria part, or put a toggle/stopper on the OpenForm and copy the sql STRING portion to the immediate test window as in:
?" and [SessionDate]>=datevalue('" & Me![StartingDate] & "')" and press ENTER.
Then you can inspect the actual values.
Or build a query in the Query builder and use the same criteria except relace the
" & Me![StartingDate] & "' with actual dates in order to test it.
Maybe the Me![StartingDate] doesn't contain an actual date string at the time the query is ran.
Or the field [SessionDate] is a string field in which case you will need to change it to a date field or change the criteria syntax to:
" and DATEVALUE([SessionDate])>=datevalue('" & Me![StartingDate] & "')" or
" and [SessionDate]>=#" & Me![StartingDate] & "#" (if the date is in the correct U.S. format)
Also, you may want to consider using BETWEEN myStartDate AND myEndDate.
by sl-campbell
Please show a copy of the complete criteria at run time (with actual values).
Only this way can correct help be given.
by john_wills
by john_wills
Have you tried surrounding both your date criteria with parentheses()?
It occurs to me that you're adding this to existing criteria, e.g.
"select * from mytable where mycityfield = 'cannes' and mydate >= startingdate and mydate <= finishdate;"
This could be misinterpreted as any two conditions together.
However
"select * from mytable where mycityfield = 'cannes' and (mydate >= startingdate and mydate <= finishdate);"
specifies that the date criteria should be considered together.
by john_wills
by john_wills
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending