Query to list the last 11 months

  • Thread starter Thread starter kingnothing
  • Start date Start date
K

kingnothing

Guest
Hi all,
I have a database which has a *ServiceDate*. I want to print out a letter(report) to all the people who have been serviced in the last 11 months...

Kindly help me out....

I'm very new to access programming

I did some reading, and couldnt come out with anything positive.

Thanks in advance

kingnothing
 
Create a query picking the information you need.

On the service date field, put the criteria:

Between DateAdd("m", -11, Date()) And Date()
 
Thanks for the quick reply,

I tried this and it worked

DateDiff("m",[Service Records]![ServiceDate],Date())>1 And <=11

I'm only trying on sample records now. Hopefully this will hold up when the real data is entered.

This seems fine right????

Let me know if there is a fault in the logic or something

Cheers

kingnothing
 
SJ MCAbney,

I am trying to use the formula you suggest :
Between DateAdd("m", -11, Date()) And Date()

And it does seem to work well and pull sout the data as indicated, I can also change this to show 12 months of data etc... H
owever can this be adapted as I want my query to show everything from the previous month of the date queried and 12 months before that.

So basically, if I run this query any time in March 05, it will show the data for February 05 back to and including February 04. Likewise if it is run anytime in April 05 it will show March 05 back to March 04.

Many thanks for your help
 
Ok I tried the following formula and it seems to show the right results

Between DateAdd("m",-13,Date()) And DateAdd("m",0,Date())

However, I had to set the final query to Zero instead of 1, to show February's data, else it only included January. Is that because today is the first or a bug in Access date calculation.?
Does this expression look correct ?

Many thanks

MattP
 

Users who are viewing this thread

Back
Top Bottom