filter form

teel73

Registered User.
Local time
Yesterday, 21:23
Joined
Jun 26, 2007
Messages
205
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:

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
 
I think if you open a report in print preview, it's a snapshot. Does it make a difference if you put some code in the button to close the report, then reopen it with the new variables?
 

Users who are viewing this thread

Back
Top Bottom