View Full Version : Filtering records by month


m17347047711116
02-13-2002, 06:58 PM
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

David R
02-14-2002, 07:43 AM
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