Last Months Sales Date Restrictor

  • Thread starter Thread starter ChuckW
  • Start date Start date
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
 
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())
 
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

As criteria on the Sales date field:
Between DateSerial(Year(Date()),Month(Date())-1,1) and
DateSerial(Year(date()),Month(Date()),0)
 
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.
 
Back
Top