Access 'Quit' event

  • Thread starter Thread starter NJS
  • Start date Start date
N

NJS

Good day people.
I need to run a macro (to flush tables)when the user closes an Access
application. I tried trapping the main form-close event but it appears
docmd.quit bypasses my form.close code?
Any suggestions will be useful.
thanks.
 
Thanks Alex,
I didn't want to use the unload event, just close (and quit bypasses it).
Does the application have a trappable event that I could use?
 
You ask for an answer
You get the correct answer
You don't like the answer
Figure out another way.
 
If you were smart enough to read the original question you probably wouldn't
write such stupid comments - get a grip!
 
I read your post in detail. You were given a good answer by a very
knowledgeable gentleman. What else do you need other than to calm down?
BTW, I am smart enough to understand the question and know the answer.
 
NJS said:
Does the application have a trappable event that I could use?

There is no application-level Quit event. If there were people wouldn't
have to resort to the standard practice, as described by Alex, of using the
Unload event of a form.

People usually use the Unload event instead of the Close event, because you
can cancel the Unload event and thereby prevent the database from closing.
However, issuing DoCmd.Quit or Application.Quit will close the application
regardless of whether you cancel the form's Close event.

If you have code that must be executed when the database closes, I suggest
you move that into a separate, public routine, and then call that routine
from wherever you were going to issue the DoCmd.Quit statement.
 
NJS said:
Thanks Alex,
I didn't want to use the unload event, just close (and quit bypasses
it). Does the application have a trappable event that I could use?

"Alex Dybenko" wrote:

You are mistaken. Quit does not bypass the close event of any open forms. If
you have code in there and issue the quit command the code Will run before
Access closes.
 
Back
Top