I am trying to figure out a way to change the filter settings for my report without having to close out the filter form or report. For example:
I have a parameter form where you can select a name or leave it blank and you can select a date or leave it blank. Then I have a button that opens the report in Preview with the applied filter. I'd like to be able to select different options and click the view button again and the filter switches. Here's what I have on the button:
I have a parameter form where you can select a name or leave it blank and you can select a date or leave it blank. Then I have a button that opens the report in Preview with the applied filter. I'd like to be able to select different options and click the view button again and the filter switches. Here's what I have on the button:
Code:
Private Sub cmdView_Click()
On Error GoTo err_cmdView_Click
Dim rpt As Report
Set rpt = Report_rptConfiscatedBadgeReport
DoCmd.OpenReport "rptConfiscatedBadgeReport", acViewPreview
rpt.Filter = "[Received at] = forms!frmReportParameters![bldg]"
rpt.FilterOn = True
exit_cmdView_Click:
Exit Sub
err_cmdView_Click:
MsgBox Err.Description
Resume exit_cmdView_Click