removing a filter

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
 
D

Douglas J. Steele

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top