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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ApplyFilter - I don't want it to save 1

Status
Not open for further replies.

keiem

Technical User
Aug 1, 2001
27
0
0
US
I have a situation where I would like to filter a form using buttons that call two different queries. The queries have conditions that prompt the user to input search criteria. I have successfully used the queries to filter my data by using buttons for each that call the ApplyFilter property in macros. The problem is that once the first macro is run, it becomes saved with the form. Then, when I run the macro again after calling a ShowAllRecords property, the filter is applied but the user is not prompted for new search criteria. The settings for the previous filter are used. This also prevents the second macro from being run successfully.

Is there any way to prevent the filter from being saved, or perhaps a way to clear/reset it so that a new "clean" filter can be run?

Thanks.
 
Thanks for the help. The Form_Open() function didn't work for me. The compiler didn't recognize the .ApplyFilter statement. Alternatively, I tried a similar statement using Me.Filter = "" and doCmd.ApplyFilter, neither of which produced the desired result. The second response was a bit more helpful, and has some great examples. It provided some good direction. I ended up getting my code to work by simply calling the ShowAllRecords property twice in the same statement. For some reason, that seems to do the trick.
 
Hey, its:

Me.Filter = ""
Me.FilterOn = False

I haven't tried it, but I suppose you could also use

Me.Filter = ""
RunCommand acCmdApplyFilterSort
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top