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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Between Times

Status
Not open for further replies.

PU36

MIS
Mar 16, 2005
202
US
I have the following

Single Table [ProductInfo]

PartNumb | Date | StartingTime | FinishingTime
121 | 9/7/2006 | 9/7/2006 12:07:05 AM | 9/8/2006 12:10:05 AM
122 | 9/7/2006 | 9/7/2006 09:11:05 AM | 9/8/2006 09:15:05 AM
123 | 9/8/2006 | 9/8/2006 12:07:05 AM | 9/8/2006 12:10:05 AM
124 | 9/8/2006 | 9/8/2006 09:11:05 AM | 9/8/2006 09:15:05 AM

I want to create a query that will select all fields from the previous day and beteen 12:00:00 AM and 08:00:00 AM.

So far I have;

SELECT *
FROM ProductInfo
WHERE DateValue(Date)=Date()-1


Which works fine for all records on that date... I'm stumped on the time thing.

Any help would be great.
 
Code:
SELECT * 
FROM ProductInfo  
WHERE DateValue([Date]) = Date()-1
  AND TimeValue([Date]) BETWEEN
      TimeValue("00:00:00") AND TimeValue("08:00:00")
 
That WORKED PERFECT.

Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top