How to: Filter a Report Using a Form's Filter

Access Developer Reference

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."
    Else
        DoCmd.OpenReport "rptCustomers", acViewReport, , Me.Filter
    End If
End Sub