Link to home
Start Free TrialLog in
Avatar of ChrisThornton
ChrisThorntonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Prompted to save changes after applying a filter

I have an Access Project connected to a SQL Server backend. There are a number of forms which are used to view the data and the "Filter by Form" button is used often to restrict the records displayed.

Whenever the users apply a filter and then close the form, they are asked whether they want to save their changes to the form. The only change they have made is to apply a temporary filter which they never want to save. In any case, the project is read-only so they cannot actually save the change anyway.

Is there any way to stop them being prompted if their only change is to apply a filter? I have tried intercepting the close event in order to undo the filter, but the prompt seems to come up before any of the events fire.
Avatar of bluelizard
bluelizard
Flag of Switzerland image

my solution to this problem was a close button with the code

  DoCmd.Quit acQuitSaveNone

behind it (but make sure you don't use that button after actually modifying the database...)


--bluelizard
Avatar of ChrisThornton

ASKER

Unfortunately the users have been using this system for some time as an mde using DAO to connect to SQL Server, so they're pretty used to closing forms by using the little cross in the corner of the form or just closing the whole app. Incidentally, the mde incarnation of the system doesn't exhibit this behaviour (any idea why there's a difference?).
Avatar of solution46
solution46

mde files are locked and Access knows that the design of a form cannot be changed - there is probably a more accurate technical description out there but this is close enough.

Why not just make an mde of your new version?

s46.
I tried that, well an ADE which is the Access Project equivalent, but I still get the prompt. It is a little different though, in that it asks whether I want to save changes to the view which the form is based on rather than the form itself. Is the filter in the project trying to save as a "where" clause in the underlying object rather than as a normal Access filter?
Something else I just found:

It only prompts to save changes after using the "Filter by Form" button. Using "Filter by Selection" or the "Filter For" on the right-click pop-up menu doesn't cause the prompt on closing the form.
I haven't tried this, but have you tried clearing the filter in the form's OnClose or Unload event?
That was my first thought too, but the prompt comes up before these events fire.
ASKER CERTIFIED SOLUTION
Avatar of miqrogroove
miqrogroove
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Miqro.

I was really hoping it was going to be something simple - but it so seldom is.

Back to the Access for Beginners course for me!

Chris.
I think of Access as a million simple pieces put together.  It is often overwhealming, but reliably so.

Glad to help,
-- Miqro