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

All records after a specified time

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
I want to return all records from a table after a certain date and a specified time.

The table has two fields (PID->long and [Date/Time]->date/time.

I've tried:
Code:
SELECT Visits.PID, Visits.[Date/Time]
FROM Visits
WHERE Visits.[Date/Time]>Date()-7 And format(Visits.[Date/Time],"Short Time")>#4:00 PM#

Can someone help me this query?

Thanks,
Rewdee
 
Hi, try this:

SELECT Visits.PID, Visits.[Date/Time]
FROM Visits
WHERE Visits.[Date/Time] BETWEEN Date()-7 AND Date()-7+#4:00 PM#

Thanks,
Jamie
 
Thanks for your reply Jamie.

Thanks to your post, I'm moving in the right direction. The query you posted returns all records between my opening time and 4:00 PM.

Ultimately, what I want is to return all visits (records) of visits after 4:00 PM between two dates. eg. Sept 9 all visits after 4:00 PM and Sept 10 all visits after 4:00 PM, etc.

Any ideas how to proceed?

Thanks,
Rewdee
 
SELECT Visits.PID, Visits.[Date/Time]
FROM Visits
WHERE Visits.[Date/Time] BETWEEN #9/9/03 4:00 PM# AND #9/10/03 12:00 AM#
OR Visits.[Date/Time] BETWEEN #9/10/03 4:00 PM# AND #9/11/03 12:00 AM#

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top