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!

Using Date in Query

Status
Not open for further replies.

tubbers

Technical User
Jun 23, 2004
198
US
I have a field called FirstDetect which is in a Date/Time format. I need to be able to run a query which would let me select records that have a FirstDetect value between say "0:00:00" and "1:00:00". How would I structure that query? I tried the following:

SELECT MasterData.TotalHits
WHERE MasterData.FirstDetect BETWEEN "0:00:00" AND "1:00:00";

but got the following error:

"Data type mismatch in criteria expression"

I'm sure its just something simple like the format of my query but I can't figure it out.

Any suggestions?

Thanks.
 
Date/time fields are delimited with "#" in Access. Try:

SELECT MasterData.TotalHits
WHERE MasterData.FirstDetect BETWEEN #0:00:00# AND #1:00:00#;


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks! That was simple and it worked just perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top