Filter Excluding Selection
acCmdFilterExcludingSelection
Filters the data on a form by excluding everthing that matches the last selected field. Place the code behind a command button called cmdFilterXSelect.
' ***************** Code Start *******************
' Code by Terry Wickenden
Private Sub cmdFilterXSelect_Click()
On Error Goto ErrHandler
Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdFilterExcludingSelection
Exit Sub
ErrHandler:
Select Case Err.Number
Case 2046 'Filter not available at moment
MsgBox "Command not available"
Case Else
MsgBox Err.Number & vbCrLf & Err.Description
End Select
End Sub
' ***************** Code End *******************