Time - Show records

G

Guest

I want to show all records of "Falls" that occur between the hours of 11 pm
and 7 am (the night shift) for the dates of 1/1/07 and 3/31/07. I have
queried the dates fine but not the time. For the critera I typed: Between
11:00 pm and 7:00 am. But I get records that are between the hours of 7:00
am to 11:00 pm.
 
M

Michel Walsh

WHERE DateTimeField >= #1/1/2007# AND DateTimeField < #4/1/2007#
AND (TimeValue(DateTimeField) <= #7:00:00#
OR TimeValue(DateTimeField) >= #23:00:00# )

note than in Jet, the operator BETWEEN re-order the arguments:

? eval( "5 BETWEEN 8 AND 2")
-1 ' which is the default value for true


so, if you ask BETWEEN #23:00:00# AND #7:00:00#, it is the same as if
you asked for:
BETWEEN #7:00:00# AND #23:00:00#



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top