davegri's code should work, but for clarity, with
2 criteria, you have
4 options.
I would add a button because if
only the country is entered, using the "optABS" click event to apply the filter, the filter for country would never be applied.
This is for a button named
"btnFilterMe":
Code:
Private Sub btnFilterMe_Click()
'neither filter selected
If Len(Trim(Me.Country)) = 0 And Me.optABS = False Then
Me.Filter = vbNullString
Me.FilterOn = False
End If
'Only ABS
If Len(Trim(Me.Country)) = 0 And Me.optABS = True Then
Me.Filter = [Main_Certification] = " & " 'ABS'"
Me.FilterOn = True
End If
'Only Country
If Len(Trim(Me.Country)) > 0 And Me.optABS = False Then
Me.Filter = "[Country] Like '*" & [txtCountry] & "*'"
Me.FilterOn = True
End If
'Both Country AND ABS
If Len(Trim(Me.Country)) > 0 And Me.optABS = True Then
Me.Filter = "[Country] Like '*" & [txtCountry] & "*'" & " AND [Main_Certification] = " & "'ABS'"
Me.FilterOn = True
End If
End Sub