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!

Select within the last hour 1

Status
Not open for further replies.

scottian

Programmer
Jul 3, 2003
955
GB
Im trying to use DateDiff to query all records worked within the last hour.

I have the field i want to filter (in this case "DateWorked") selected in the query, and set the Criteria to "DateDiff("h",Now(),Now()-1)". Im assuming i have it wrong as it doesnt return any results. Either im using the wrong function to filter, or i dont understand how its set up.
Can anyone tell me what im doing wrong

"My God! It's full of stars...
 
Try this for the Criteria:

Between DateAdd("h", -1, Now()) And Now()

You actually want a range of times and DateDiff gives a numeric difference...

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
thank you mstrmage...excellent

"My God! It's full of stars...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top