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

CREATE QUERY THAT RUNS CURRENT DATE PLUS LAST 3 DAYS

Status
Not open for further replies.

baudouxnorthrup

Technical User
Feb 19, 2003
16
US
I need to create a query that will give me information for the current date plus the 3 previous days.

I tried to use the current date expression -1 AND -2 and -3 but that didn't work.

How do I set up my query to return current date, and the 3 days prior to that.

Thanks so much!!
 
Hi,

you should try this criteria

Between Now() And DateSerial(Year(Now());Month(Now());Day(Now())-3)

For your date field.

It should do the trick! SG
 
For a little extra speed, the "DateSerial(...)" command can be replaced with "Date() - 3".

If your data field includes the time, just to be safe when you reference that field in your query's WHERE clause, use "int(DateField)". Probably not a worry, but if there are multiple users and the computers have even slightly different clocks, it is possible for the query suggested in the previous post to miss an entry.
 
If you are using the query by design option, the criteria under the date field becomes

>(now()-3)


telephoto
 
Thanks to all who responded. I got it to work now and am very happy and very grateful to the folks who responded.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top