Private Sub cmdApplyFilter_Click()
    Dim strOffice As String
    Dim strDepartment As String
    Dim strFilter As String
' Check that the report is open
    If
SysCmd(acSysCmdGetObjectState, acReport, "rptStaff") <> acObjStateOpen Then
        MsgBox "You must open the report first."
        Exit Sub
    End If
' Build criteria string for Office field
    If
IsNull(Me.cboOffice.Value) Then
        strOffice = "Like '*'"
    Else
        strOffice = "='" & Me.cboOffice.Value & "'"
    End If
' Build criteria string for Department field
    If
IsNull(Me.cboDepartment.Value) Then
        strDepartment = "Like '*'"
    Else
        strDepartment = "='" & Me.cboDepartment.Value & "'"
    End If
' Combine criteria strings into a WHERE clause for the filter
    strFilter = "[Office] " & strOffice & " AND [Department] " & strDepartment
' Apply the filter and switch it on
    With
Reports![rptStaff]
        .Filter = strFilter
        .FilterOn = True
    End With
End Sub

Private Sub cmdRemoveFilter_Click()
    On Error Resume Next
' Switch the filter off
    Reports![rptStaff].FilterOn = False
End Sub