Table of contents
Collapse the table of content
Expand the table of content

Filter a Report Using a Form's Filter

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

The following example illustrates how to open a report based on the filtered contents of a form. To do this, specify the form's Filter property as the value of the OpenReport method's WhereCondition argument.

Private Sub cmdOpenReport_Click() 
    If Me.Filter = "" Then 
        MsgBox "Apply a filter to the form first." 
        DoCmd.OpenReport "rptCustomers", acViewReport, , Me.Filter 
    End If 
End Sub
© 2018 Microsoft