Month Ranges

D

DNguon

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
 
K

KARL DEWEY

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())
 
D

DNguon

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
 
Top