Last Months Sales Date Restrictor

C

ChuckW

Hi,

How do I do a date restrictor that will give me last
month's sales? So it would give me Dec 1 to Dec 31 now
but in february it would roll to give me Jan 1 to Jan 31.

Thanks,

Chuck
 
A

Allen Browne

Try this in the Criteria row of your query, under your date field:
Between DateSerial(Year(Date()), Month(Date()) - 1), 1) And Date() -
Day(Date())
 
J

JL

Hi ChuckW,

Since you only need the last month. You have to compare it just month and
year portion of your sales date against today's date.
The query wuold be as follow.

Select [SalesDate], [SalesAmount]
from SalesTable
where format([SalesDate], "YYYYMM") = format(DateAdd("m",-1,Now()), "YYYYMM");

Hope this helps.
 
Top