Previous Month Query

  • Thread starter Thread starter NFL
  • Start date Start date
N

NFL

This formula will give me the previous month (which is March 2010) and will
also include 01 April 2010 data.
Between DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())-1,0)

I tried this formula, but 31 March 2010 will not show up.
Between DateSerial(Year(Date()),Month(Date()),-1) And
DateSerial(Year(Date()),Month(Date())-1,0)

Regardless of how many days in the month, is there way this can be fixed to
show only the previous month?

Thank you!
 
NFL -

This goes from the first of last month to the day before the first of this
month:

Between DateSerial(Year(Date()),Month(Date()-1),1) And
DateSerial(Year(Date()),Month(Date()),0)
 
This formula gave me the last day of the previous month and the 1st day of
the current month. (31 March 2010 thru 01 April 2010).
 
This formula will give me the previous month (which is March 2010) and will
also include 01 April 2010 data.
Between DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())-1,0)

I tried this formula, but 31 March 2010 will not show up.
Between DateSerial(Year(Date()),Month(Date()),-1) And
DateSerial(Year(Date()),Month(Date())-1,0)

Regardless of how many days in the month, is there way this can be fixed to
show only the previous month?

Thank you!

If your date/time field contains a time portion, you'll want to get up through
11:59:59.9999999 PM on the last day of the month. A handy way to do so is:
= DateSerial(Year(Date()), Month(Date()) - 1, 1) AND < DateSerial(Year(Date()), Month(Date()), 1)

That is, any date/time value greater than or equal to midnight at the
beginning of the first day of last month, and prior to midnight at the start
of the first day of this month.
 
That worked... thank you for your help!

John W. Vinson said:
If your date/time field contains a time portion, you'll want to get up through
11:59:59.9999999 PM on the last day of the month. A handy way to do so is:


That is, any date/time value greater than or equal to midnight at the
beginning of the first day of last month, and prior to midnight at the start
of the first day of this month.
 
NFL -

Sorry - misplaced parenthesis...

This:
Between DateSerial(Year(Date()),Month(Date()-1),1)

should have been this:
Between DateSerial(Year(Date()),Month(Date())-1,1)
 
Back
Top