Ask for a date range to print on command click

jleval

Registered User.
Local time
Today, 06:47
Joined
May 16, 2012
Messages
53
I have a form that prints the current record on a report. My boss tells me he needs to do the same thing but wants to print records within a certain date range. Is there a way to do this without having to switch the record source to a parameter driven query? If I can only do it through a query then how would I set my command button to change the record source? You guys have helped me so much so this is why I keep coming to you.
Thanks
 
Just add two controls to capture the start and end dates to the form and then you can filter the report in the click event on the command button to:

Code:
Dim strWHERE As String
 
strWHERE = "[DateFieldNameHere] Between #" & Me.txtStartDate & "# AND #" & Me.txtEndDate & "#"
 
DoCmd.OpenReport "ReportNameHere", acViewPreview, , strWHERE
 

Users who are viewing this thread

Back
Top Bottom