Hi Lvenom,

put this code on a general module sheet

'~~~~~~~~~~~~~~~~~~~~
Sub filterOnOff( _
pBooEqual As Boolean)

'written by Crystal
'strive4peace2007 at yahoo.com

'PARAMETERS
'pBooEqual --> true to match, false to exclude


On Error GoTo Proc_Err

Dim FilterCriteria As String, mMsg As String

If pBooEqual Then
FilterCriteria = InputBox( _
"Enter Scheduled Downday to Match (MM/DD/YY)")

'user clicked Cancel
If FilterCriteria = "" Then Exit Sub

Selection.AutoFilter Field:=12, _
Criteria1:=FilterCriteria
Else

'To exclude specific date
FilterCriteria = InputBox( _
"Enter Scheduled Downday to Ignore(MM/DD/YY)")

'user clicked Cancel
If FilterCriteria = "" Then Exit Sub

Selection.AutoFilter Field:=12, _
Criteria1:="<>" & FilterCriteria, _
Operator:=xlAnd
End If

Proc_Exit:
On Error Resume Next
Exit Sub

Proc_Err:
Select Case Err.Number
Case 1004
'turn on autofilter
'assume L2 is valid
Range("L2").Select
Selection.AutoFilter

Resume
Case Else
MsgBox Err.Description, _
, "ERROR " & Err.Number _
& " filterOnOff"
'press F8 to step through code and debug
'remove next line after debugged
Stop: Resume
End Select
Resume Proc_Exit
End Sub

'~~~~~~~~~~~~~~~~~~~~
and then here is code for 2 command buttons behind the
respective sheet:

'~~~~~~~~~~~~~~~~~~~~
Private Sub IsEqual_Click()
filterOnOff True
End Sub

Private Sub IsNotEqual_Click()
filterOnOff False
End Sub
'~~~~~~~~~~~~~~~~~~~~



Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Lvenom wrote:
> I have a macros to filter data based on user input that works just fine.
> My problem is when the user input is supposed to be the data excluded
> from the filter my macro doesn't seem to filter out the undesired data.
> (Data is date related with one filter asking to see data from a specific
> date and the other fliter asking not to see data from a specific date.
> My code is below...can anyone see my mistake? Thank you in advance for
> your help
>
> To include specific date:
> 'Get the filter's criteria from the user
> FilterCriteria = InputBox("Enter Scheduled Downday.(MM/DD/YY)")
> 'Filter the data based on the user's input
> Selection.AutoFilter Field:=12, Criteria1:=FilterCriteria
>
> To exclude specific date
> 'Get the filter's criteria from the user
> FilterCriteria = InputBox("Enter Scheduled Downday.(MM/DD/YY)")
> 'Filter the data based on the user's input
> Selection.AutoFilter Field:=12, Criteria1:="<>FilterCriteria"
>
>