Pulling records given a time and date perimeter.



I'm trying to run a report that gives information based on dates and time ranges. The table provides the date and time information as one date time format example.... "03/01/04 08:00:00 AM"

So what I want to do is find all records for the month of Febuary only between the hours of 8am to 5pm during the weekdays. Excluding all other records on the weekends and the hours of 5:01pm and 7:59am

Any ideas?

John Spencer (MVP)

WHERE DateTimeField >= #2/1/04# AND DateTimeField < #3/1/04#
AND Hour(DateTimeField) Between 8 and 16
AND WeekDay(DateTimeField) Between 2 and 6

If you want all years then change the first line to
WHERE Month(DateTimeField) = 2
AND ...

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