Query filter to display records in a time frame

Jaysc

New member
Local time
Yesterday, 19:29
Joined
May 8, 2007
Messages
6
Hi all, working on a simple DB for myself involving cell phone records. I'm wanting to write a query that will ONLY display records that start the call before a specified time (in my case, 9pm) and until another time (say, 5am). I can't quite seem to get the parameters working that will filter out those results that I want as I either get a blank query, or it displays all the records that exist if I didn't enter the filter criteria in the first place.

How, if any way, can I put this time range into a query to make a filter to display these records? Any assistance on this would be greatly appreciated, thanks. :)
 
Are you storing the date and time of the call in the same field?

Hopefully you are. If you are then use the Between like this:

Code:
Where [CallStart] Between #2/12/2009 21:00# and #2/13/2009 05:00#

or

Code:
Where [CallStart] Between #2/12/2009 9:00PM# and #2/13/2009 5:00AM#


or maybe you want:

Code:
Where TimeValue([CallStart]) Between #5:00AM# and #9:00PM#


I am not real clear with yuy are wanting.
 
No, I'm doing date and time fields separate as that is how the data was given to me by the company. Ex:
-------
Date Time Minutes
-------

What I want is to specify a time range between 9pm and 5am for the time field and only have the records show up that fall outside of that range. My apologies if I was misclear in stating that in my OP.

The third example looks best, I'll give that a shot.

Edit: Tried the third example and it's working perfectly. Thanks for the help.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom