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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inclusive dates criteria in a query 1

Status
Not open for further replies.

robojeff

Technical User
Joined
Dec 5, 2008
Messages
220
Location
US
I have a query which uses an end date from a form to determine the range of the data that I wish to extract from MY_tbl in which I would like to gather 12 months of data up until the end date.

I need some help with the criteria of this query as it gives me 12 months of data but leaves off the month (or partial month) of data for the month of the End date...

How can I tweak the following criteria to capture the portion of the current month (the form's end date month) and still include that month from the previous year?

Here is the criteria portion of my SQL:
Code:
 WHERE (([My_tbl].Date) Between DateAdd("yyyy",-1,[Forms]![My_rpt]![EndDate]) And [Forms]![My_rpt]![EndDate])

thank you
 
WHERE My_tbl.Date Between DateSerial(Year([Forms]![My_rpt]![EndDate])-1,Month([Forms]![My_rpt]![EndDate]),1) And DateSerial(Year([Forms]![My_rpt]![EndDate]),Month([Forms]![My_rpt]![EndDate])+1,0)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That works great... thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top