Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range Question

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I am using the following criteria in a query to pull data between specific hours for a specific day:


Code:
Between DateAdd("h",18,DateAdd("d",-2,Date())) And DateAdd("h",19,DateAdd("d",-1,Date()))

The above works great except when trying to do the following....If i want to pull data from a range of dates, say between -1 days and -5 days it grabs all of the data from the first date to the last date, not just from in between 9am and 6pm for each day.

How can I pull data between a range of dates and only have it pull the data for each day between those times? Hope this makes sense.

Any suggestions or help is appreciated!

Thanks!

Paul
 

where ..... and
Cdbl([YourDateTimeField]) - Int([YourDateTimeField]) Between 0.375 AND 0.75
 
Another way:
... AND Format([YourDateTimeField],'hh:nn') Between '09:00' And '18:00'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
JerryKlmns, Thanks! that worked great for the times but how do I narrow down to date ranges? This just shows everything in the database between those times.

thanks again!

Paul
 
WHERE Int([YourDateTimeField]) Between Date()-5 And Date()-1
AND Format([YourDateTimeField],'hh:nn') Between '09:00' And '18:00'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV, i didnt see your post before i posted my last question...I will try that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top