Remove Filter

A

Allen Browne

Set the FilterOn property of the form to False:
Me.FilterOn = False
or:
Forms![Form1].FilterOn = False

It is a good idea to explicitly save the record before any operation that
requires it to be saved, so:
If Me.Dirty Then Me.Dirty = False
 
D

Dana

I have done this and it works, but I noticed that if I bring up the property
sheet for my form while in design view, the Filter property retains the last
query that was performed. It isn't affecting the function of my form, but it
bugs the heck out of me. Any clues?
 
J

jeff

Dana

I believe its a quirk of Access. Access actually saves the filter last set
with the form object automatically and setting it to an empty string
actually does nothing. So the setting of the Filter = "" could be left out.
IF you want to clear the last filter used you could use the following
Me.Form.Filter = "'" (ie double quote, single quote, single quote, double
quote). This actually sets the Filter to '' and this will be saved so you
will see it in Design mode.
Other than that i can offer no other explanation...maybe someone else can?

cheers
Jeff

Remember that what is actually happening when you set the Filteron = True
the value in the Filter property is added to the WHERE clause, so it MUST be
a valid string. '' implies that you get a WHERE '' which is a valid where
clause.
 
Top