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

Code for pulling records based on "last weeks" date 1

Status
Not open for further replies.

marie515

Technical User
Feb 27, 2004
71
0
0
US
Hi there,

I want to have a query that pulls records based on the "ReceiptDate". I'd like to pull all records received "last week".

How can I tell it to pull all records for the following example:

Today is March 19th.

I'd like last weeks records, so I'd like all records with a receipt date of Sunday, the 7th of March through Saturday, the 13th.

Is there code that says "last week"? I know there is code for last month, next month, and current month and I know how to code for current week, but not how to do a week ago.

I was using the following code, but this is not working:

Between Date() And Date()-7

Any suggestions?
 
Hi!
I hope this solve your problem.
In your query add a field: LastWeek: DatePart("ww",[your field Date]), and in the criteria of this field put this: =DatePart("ww",Date())-1.
That’s it.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top