Query filter using a moving date....HELP!!

W

WhytheQ

I'm new to Access, so please bear with my lack of correct terminology!
I have a daily report where the data goes back a few years. Each day
another days worth of data is added to the raw data.
I want to extract only the last 365 days worth of data.
Is it possible to create a query where the filter will extract only the
past 365days: then when I look at the recordset in a weeks time the
start date will have also moved on a week?

Any help greatly appreciated
Jason
 
D

Duane Hookom

Sure this is possible. I expect you have a date field that you can set a
criteria like:
= DateAdd("yyyy", -1, Date())

This will show all records where the date field is within the last year from
today's date.
 
W

WhytheQ

Thanks for this Duane,
Don't think I understand the DateAdd function properly! Is the reason
you've used this to take account of leap years? (otherwise you would
have used: >=Date()-365)

Jason
 
D

Duane Hookom

The DateAdd() function is used because:
- it handles leap years
- I think DateAdd(), DatePart(), DateSerial(), and other date functions
are easier to understand and maintain
 
Top