View Single Post
  #2  
Old November 24th, 2009, 08:31 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 24 rolling periods

What are you actually storing in your table, the period number or a date or
something else? Typically you can use DateAdd() and/or DateSerial() functions
to describe a rolling range of dates. Your criteria might look like:

Between DateSerial(Year(Date()), Month(Date())- 24,1) And Date()

The above would filter to the previous 24 months from the 1st day of the
starting month.


--
Duane Hookom
Microsoft Access MVP


"mccloud" wrote:

We have an ERP system that stores monthly qty's sold information by item. So
Nov 2009 is period 23. Jan 2010 will be period 01. Query will work from a
form where user will enter number of past periods to review and the item.
(.e.g. 6) entering 6 would need to add periods 22 thru 17. I thought about
building a table with (if period = 23 then add these periods together but it
would need to be huge to consider all possible combinations. Any one have a
better way?