Previous Month Query

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!
 
D

Daryl S

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)
 
N

NFL

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).
 
J

John W. Vinson

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.
 
N

NFL

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.
 
D

Daryl S

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)
 

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