Calulating months

jake7363

Registered User.
Local time
Today, 19:36
Joined
Mar 14, 2005
Messages
46
Hi,
I am trying to create a query that will show data in a rolling four month period. Example: For September, show June through September; for October, show July through October.
I am using a general date format in the field. I can use >DATE() - 120 to get a 120 day period, but that obviously does not give me data for the actual Calendar dates. Is there a better way?


Any and all suggestions will be greatly appreciated.
Thanks in advance,
Jake
 
re:

Hi,
use the DateAdd() function in the criteria of your date/time field e.g.:

BETWEEN DateAdd("m",-4,Date()) AND Date()

If you just want to query on the month and the year then create two new expressions...one:

JustMonth: Month([YourDateField])
Criteria: BETWEEN Month(DateAdd("m",-4,Date())) AND Month(Date())

and

JustYear: Year([YourDateField])
Criteria: Year(Date())

HTH
Good luck
 

Users who are viewing this thread

Back
Top Bottom