Problem with between date function

C

CP

I have an expression which i use to pick out a date range - I am trying to
use it every month but it can pick up the same day twice over two months?

Between DateSerial(Year(Date()),Month(Date())-5,1) And
DateSerial(Year(Date()),Month(Date())-5,0)

This does not seem to do what I want for is to pick up all the dates from
the 1st to the 31st 5 months back

I put in these dates - 1/3/07, 31/3/07, 1/4/07, 30/4/07
It only picked out 31/3/07, 1/4/07

Todays date being 15/9/07 - is was expecting to see 1/4/07, 30/4/07

Any help ?
 
R

Rick Brandt

CP said:
I have an expression which i use to pick out a date range - I am
trying to use it every month but it can pick up the same day twice
over two months?

Between DateSerial(Year(Date()),Month(Date())-5,1) And
DateSerial(Year(Date()),Month(Date())-5,0)

This does not seem to do what I want for is to pick up all the dates
from the 1st to the 31st 5 months back

I put in these dates - 1/3/07, 31/3/07, 1/4/07, 30/4/07
It only picked out 31/3/07, 1/4/07

Todays date being 15/9/07 - is was expecting to see 1/4/07, 30/4/07

Any help ?

The zeroth of a month is the last day of the previous month so that DateSerial
expression should subtract 4 from the month, not 5.
 
T

tlove258

I have an expression which i use to pick out a date range - I am trying to
use it every month but it can pick up the same day twice over two months?

Between DateSerial(Year(Date()),Month(Date())-5,1) And
DateSerial(Year(Date()),Month(Date())-5,0)

This does not seem to do what I want for is to pick up all the dates from
the 1st to the 31st 5 months back

I put in these dates - 1/3/07, 31/3/07, 1/4/07, 30/4/07
It only picked out 31/3/07, 1/4/07

Todays date being 15/9/07 - is was expecting to see 1/4/07, 30/4/07

Any help ?

Hey there...I just used yours to resolve my problem. I think it might
be that you shouldn't have the -5 twice...try a -6 on the first one
like this:

Between DateSerial(Year(Date()),Month(Date())-6,1) And
DateSerial(Year(Date()),Month(Date())-5,0)

Good luck
 

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