Month Ranges

G

Guest

Hey,

I'm Trying To Show A Rolling Change In A Query. I Want To Always See The
Last Three Months Of Data.

Between Date() And DateAdd("m", -3, Date()) Shows Me The Last Three Months,
But Dose Not Recognize Months Instead Automatically Shows Me The Last 90 Days.

Example Today Is 07/22/05. I Want To See The Last Three Whole Months(All Of
April, May And June). Not The 22nd Of April To The Today.

Then Next Month Iwant To Automatically See All Of May, June And July(Whole
Months, 1-31).

Can Anyone Help?

Thank You
 
G

Guest

Below will give you the three month prior to the current month.

Between
DateAdd("m",-3,Date()-Day(Date()))-Day(DateAdd("m",-3,Date()-Day(Date())))+1
and Date()-Day(Date())
 
G

Guest

Thank You.

It Worked But For Some Reason It Gave Me The Last 4 Months. So I Changed The
Numbers To 2 And It Worked, It Gave Me The Prior 3 Months.
 
G

Graham R Seach

This will also work:

BETWEEN DateSerial(Year(Date()), Month(Date()), 0) AND
DateSerial(Year(Date()), Month(Date())-3, 1)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top