Show previous month

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need criteria for a query that will filter out the previous month's records.
Any help would be greatly appreciated.
Paul
 
Let's say the date field in your query is named MyDate. You need to add two
calculated fields to your query. The first looks like:
=Month(MyDate)
and the second looks like:
=Year(MyDate)

Now put the following criteria in the first calculated field:
Month(DateAdd("m",-1,Date)
and put the following criteria in the second calculated field:
Year(DateAdd("m",-1,Date)

Your query will return only the records for the previous month.

If you want all records but the previous month, change your criteria to:
<> Month(DateAdd("m",-1,Date)
<> Year(DateAdd("m",-1,Date)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
I need criteria for a query that will filter out the previous month's records.
Any help would be greatly appreciated.
Paul

A criterion of
= DateSerial(Year(Date()), Month(Date()) - 1, 1) AND < DateSerial(Year(Date()), Month(Date()), 1)

will do this if applied to a date/time field.

John W. Vinson [MVP]
 
Paul.S said:
I need criteria for a query that will filter out the previous month's records.
Any help would be greatly appreciated.
Paul

Thank you!
 

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

Back
Top