Filtering records by month

m17347047711116

Registered User.
Local time
Today, 22:59
Joined
Feb 4, 2002
Messages
68
Currently i have a form that i use to print a report for a specified date range i am using the following code:

DoCmd.OpenReport "Maintenance Request Query by Date", , , "[Date] Between #" & Format(Me.StartDate, "mm\/dd\/yyyy") & "# And #" & Format(Me.EndDate, "mm\/dd\/yyyy") & "#"

What i would like to do is change the code so that i can i have a pull down menu select a month ie. January and have a report for all records in the month of January.

Thank You In Advance
 
No no no. Do not duplicate the data in your table just because you need to format it. (Ack, I'm beginning to sound like one of those gurus)

Add a column to a query based on your table. In a blank field, put MonthName: Format([DateField],"mmmm") <use 1 to 4 m's depending on the format you want to show - look up Format Date/Time in Access help>

This will accomplish the same thing without storing extra data. Make sure you get them to enter the parameter in the same format, or convert it to that format before you test it.

HTH,
David R
 

Users who are viewing this thread

Back
Top Bottom