Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Month Date 1

Status
Not open for further replies.
Feb 25, 2008
46
0
0
US

I am trying to automate the entry of a date range in a query.

One of my co-workers has to run a query for a report showing details of last month's sales at various times in the current month.

He has to enter the date of first day and last day of the previous month everytime in the parameter prompts.

Is there a way to eliminate this by having the criteria in the date field lookup the date range between the minimum and the maximum dates of the previous month?

Thanks,
Mark.
 
Code:
Where month(invoicedate)= month(dateadd("m",-1,Date)) and year(invoicedate)= year(dateadd("m",-1,Date))
 
In the criteria cell of the date field:
Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV your criteria works perfectly!

pwise, I was looking for a solution like PHV suggested but thanks to you too for taking the time to help me.

Thanks,
Mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top