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!

Access 97 Relative Date Query 1

Status
Not open for further replies.

quickster2

Technical User
Sep 11, 2003
7
0
0
US
I have a single table that I need to provide a 13 rolling month report. I can create a query for each month & year, but I only want to create the queries for this once using a variable that will calculate the previous 13 months for me. I have tried the datrediff, dateadd, etc. in several different configurations and have failed miserably.

Any assistance would be apperciated.

Thanks

 
have you tried... dateadd("m",-13,date())
 
Yes I have. Unfortunately, the months that I can go back is only in the current year.
 
Also, the data returened from the query is only from one day rather than the entire month.
 
Hmmmm,.... I have no trouble with this in access 2k


adding this criteria to a date field ....

>=DateAdd("m",-13,Date())
 
Almost there. When I added it, It returned all dates past the 13th month. I added the following and it returned only July & August of last year: <=DateAdd(&quot;m&quot;,-13,Date()) And >DateAdd(&quot;m&quot;,-14,Date()).

It also only listed dates up to today's date rather than the whole month.

Any other thought would be appreciated.

Thanks in advance.
 
Try this one....

>=DateAdd(&quot;m&quot;,-13,Month(Date()) & &quot;/1/&quot; & Year(Date()))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top