Retrieving one months data

K

kbrad

I want to extract one months worth of data from my table.
This statement gives me all the data the last 6 months:
Between DateSerial(DatePart("yyyy",Date()),DatePart("m",Date())-6,1) And
Date()-(DatePart("d",Date()))

What I actually want is for just the 6th month ago - that is data just for
Feb if it is August now, data just for last October if it is now April.

Any ideas?
 
K

KARL DEWEY

Try this --
Between DateAdd("m",-6,Date()-Day(Date()))+1 And
DateAdd("m",1,DateAdd("m",-6,Date()-Day(Date()))+1)-1
 

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