Access 'Quit' event

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.
 
N

NJS

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?
 
K

Klatuu

You ask for an answer
You get the correct answer
You don't like the answer
Figure out another way.
 
N

NJS

If you were smart enough to read the original question you probably wouldn't
write such stupid comments - get a grip!
 
K

Klatuu

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.
 
D

Dirk Goldgar

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.
 
R

Rick Brandt

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.
 

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

Similar Threads

Exiting Access 4
Object or class not supported 3
Application object in class module 2
Quit Access 2
Launching another MS Access application within code 6
Global Quit 2
Quit & Open 12
Quit command in Access 2007 7

Top