Access 2007 Query ?

thefiddler

New member
Local time
Today, 13:51
Joined
Sep 27, 2010
Messages
3
Can anyone help with building a Query/Syntax in Access 2007, for extracting records from a time and date range of lets say today 0300hrs until Tomorrow 0300hrs. It's driving me nuts !!! :mad:
Thanks in advance :rolleyes:
 
SELECT...WHERE DateTimeFieldName Between #9/27/10 3:00 AM# And #9/28/10 3:00 AM#
 
Many thanks PBaldy and I understand your reply, however there is another scenario that I need answering and your the possible man to do it.
I have an Access 2007 database of 12,000 records with various numbers of records per day. I have fields of Date, Time, Cost. What I am trying retrieve is the Total of Costs over Every 24hr period but between the hours of 0305hrs and 0300hrs. Would you be able to explain how to make a query on this basis.
Once again many thanks in advance :)
 
Create a calculated field in your query that returns a date; if the time is before 3:00, use the day before, else that day's date (or whatever logic fits your needs). That should give you a field to group on that breaks the data up the way you want.

By the way, field names of Date and Time will cause you problems in the long run, as Access can confuse them with the functions of the same name.
 

Users who are viewing this thread

Back
Top Bottom