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.
 

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