Clear Filters

A

Aaron

Hello all.

I am trying to avoid my users from saving filters. The fact is that
after they use or change a filter, when closing the form Access would
ask: "Do you want to save changes to the design of form?" and save the
new filter.

I've tried using Me.Filter = "" in the unload event, but Access asks
and saves BEFORE getting to the unload, and it saves the filter before
I clear it.

Also tried setting the property "Allow design changes" to "Design view
only" but functionality remains the same: users CAN change the design
(filters in this case) to the form, so it seems the property doesn't
work as intended.

I don't want to write code in a button as has been suggested to clear
the QBF grid, I just want to avoid saving the filters and being
prompted to save the form, which confuses them.

Would be glad to hear any suggestions from you.

TIA,
 
K

Ken Snell [MVP]

I assume that you have a command button that the user clicks to close the
form. Just put the Me.Filter = "" code step in that "Click" procedure. Or
you could put the code step in the form's Close event procedure.
 
A

Aaron

I wouln't like to use a close button in the form.

Right now my only solution has been to add one button and either follow
your suggestion or use DoCmd.Close Form, acSaveNo

Thanks for the quick response...
 
G

George Nicholson

Wherever you are closing the form from:
DoCmd.Close acForm, Me.Name, acSaveNo

acSavePrompt is the default for the last argument when not specified. They
won't get a prompt if you specify No.

HTH,
 
G

George Nicholson

You could also set the filter to "" when the form opens, leaving any saved
filters moot.
 
A

Aaron

Thanks all for your replies.

I will stay with the Open event cleaning the filter, and adding a
button to close and call DoCmd.Close acSaveNo.

I couldn't use the Close event because by the time the Unload or Close
get control, the form has already been saved with the filter.

Thanks again!
 

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