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!

Last Weeks Dates! 1

Status
Not open for further replies.

Gojira999

Technical User
Jun 22, 2004
57
GB
I have built a query that finds the a table entry with todays dat using date(). So far so good.

What I also want to do is have the query find entries for 7 days ago, 14 days ago & 28 days ago. I tried doing this by adding an OR date()-7 etc criteria. This didn't work. So I tried DateAdd("d",-7,Date()). This didn't work either.

The relevent SQL command is:

WHERE (((Table_WorkReturnsProject_ret.Date)=Date() Or (Table_WorkReturnsProject_ret.Date)=DateAdd("d",-7,Date())));

Any advice would be gratefully consumed!

Thanks.
 
Hi
SELECT Table1.Whatever
FROM Table1
WHERE (((Table1.Whatever)=Date() Or (Table1.Whatever)=Date()-7));
etc
 
And what about this ?
WHERE (Date()-Table_WorkReturnsProject_ret.Date) IN (0,7,14,28)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top