Previous Month in query

P

programmingrookie

I have a date field "reportdate" set to a short date format. I want to pull
the month and year of the previous month as a criteria for a query. For
instance, for January 2008, I want to pull all records from December 2007.
Any ideas would be greatly appreciated.
 
K

KARL DEWEY

In design view add a calculated field like this ---
Report_Month: Format([YourDateField], "yyyymm")

In criteria for the field use ---
Format(DateAdd("m", -1, Date()), "yyyymm")
 

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