Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2007 'Clear All Filters' Button 1

Status
Not open for further replies.

McLiguori

Technical User
Mar 27, 2003
90
IT
Using Access 2007. When I apply a filter to my db, if I save and close, the next time I open the db, the filter is still present. If I select Clear All Filters from the ribbon, this does not happen. The filter is completely cleared and the db reopens with no filters applied.

I want to include a button to Clear All Filters. I have tried the following code in the button event:
Me.FilterOn = ""
Me.Filteron = False

also
Me.FilterOn = False
Me.FilterOn = ""

And all sorts of variations on this theme.

Clicking the button clears the filter for the session, but the next time I open the db, the filter reappears.

This does not happen when I use the Clear Filters in the ribbon. It clears the filter for the session and it does not reappear the next time the db is opened.

What is the code for the button in order to emulate clicking on the Clear All Filters in the ribbon (under 'Advanced' in the sort and filter section)?

When I open the form in design view, the code(s) I have tried do not clear the Filter property under the data tab. Clicking on the Ribbon Clear All Filters does clear it.

I appreciate any help you can give me. Thanks.

McLigs
 
what about this ?
Me.FilterOn = False
Me.Filter = ""

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV. I have an OOPS in my original post. I did try what u suggested:
Me.FilterOn= False
Me.Filter = ""

I mistyped the second line of code as:
Me.FilterOn = ""
Sorry!

Your suggestion clears for the session, but leaves the filter saved in the filter property of the form (under the data tab).
 
and this ?
DoCmd.RunCommand acCmdRemoveAllFilters

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top