Remove Filter

  • Thread starter Thread starter John
  • Start date Start date
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
 
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?
 
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.
 

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

Back
Top