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!

Show records from today and last seven days

Status
Not open for further replies.

qshaz

Technical User
Feb 1, 2002
17
0
0
AE
I want to make a criteria in my query to show me all records only dated today and in the last seven days. How would I enter my criteria for this? Thanks!!

Shazia
 
You could try:

SELECT *
FROM YourTable
WHERE YourDateField Between Date() And DateAdd("d",-7,Date())

If you are in query design mode instead of SQL mode just type the following into the criteria for your date field:

Between Date() And DateAdd("d",-7,Date())
 
Thanks!

And supposing I wanted to see all records only from BEFORE the last week (i.e not include last weeks records in this query)?

Thanks again for all your help!
 
SELECT *
FROM YourTable
WHERE YourDateField Between DateAdd("d",-8,Date())
And DateAdd("d",-14,Date())

Kyle [pc1]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top