How do I get my Query show only the last 5 days of data?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a large database of data, I would like to only display the last week
of this info every week in a query or report?
 
In the Criteria of an appropriate Date field put something like

Between Date() -7 and Now()

Now if you need the last calendar week, it gets a little more complicated.
Something like below will almost work; however it will probably bomb out
during the first week of January.

SELECT tblDates.wa_date,
DatePart('ww',[wa_date]) AS TheWeek,
Year([wa_date]) AS TheYear
FROM tblDates
WHERE (((DatePart('ww',[wa_date]))=DatePart('ww',Date())-1)
AND ((Year([wa_date]))=Year(Date())));

It's a bit snarky, but you can get from Sunday before last through
last Saturday with a criterion
= DateAdd("d", -6-Weekday(Date()), Date()) AND < DateAdd("d", 1-Weekday(Date()), Date())

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top