removing a filter

  • Thread starter Thread starter DZ
  • Start date Start date
D

DZ

1. In a form at runtime a cmdbutton1_Click sets a filter
me.Filter = "Name like '*Smith*'"


2. cmdbutton2_Click display the current filter
msgbox me.filter

The message box displays "Name like '*Smith*'"
No problem


3. cmdbutton3_Click removes the filter
me.Filter = ""

4.
cmdbutton2_Click display the current filter
msgbox me.filter

The message box displays "Name like '*Smith*'"
WOW ! Why is that !

5.
But if i click cmdbutton3_Click to remove the filter twice or if I place the

me.Filter = "" statement twice in a row like

me.Filter = ""
me.Filter = ""

then cmdbutton2_Click display the current filter as
me.filter = ""

++++++++++++++++++++++++++
So it appears that the Me.Filter = "" has to be executed twice to remove the
filter from the form at runtime.

Can anyone explain why this occurs

Thanks
 
I'm not sure why you're experiencing that, but to remove a filter, you
should set

Me.FilterOn = False

(in addition to setting the filter to a zero-length string)
 
Back
Top