Macro to run on exit

northy

Registered User.
Local time
Today, 10:31
Joined
Jul 30, 2001
Messages
16
I need to write a macro (to communicate with Excel) that runs when a database is exited after modification. Any ideas?
 
Though I didn't have a macro to run, I had some procedures to run on DB exit.

The way I did it was to define an opening (startup) form as a "splash screen" for my DB. I turned off the Access "close" buttons for the form and instead put a Close button on the form using the wizard. But instead of actually closing the form, I just minimized it and made it invisible. Requires a little bit of VBA code, but not much.

In that form's OnExit event routine, I ran the code I wanted to run. So what happens if someone exits Access is that first all the open forms run their OnExit code. You could even stop the exit operation from at least one of the event routines, I forget which one at the moment. (This posting is kind of "shooting from the hip".)

The only time the code doesn't run is if someone crashes their system while Access is still open. But that is a relatively rare occurrence, so it works pretty well. I would guess you could run your macro there?
 
I'm bumping this to make some more comments on this procedure. We need to make sure folks are logged out while closing the DB.

Talk to yal'll soon.
 
We need to make sure folks are logged out while closing the DB..

What do you mean by "logged out"?

What do you need to preform when your application is exiting?

Have you blocked simply Exiting all of Access via the Top Left X button?

Have you blocked simply closing all of the Forms, then being able to free-wheel close Access via the Top Left X button?

etc...
 
What do you mean by "logged out"?

What do you need to preform when your application is exiting?

Have you blocked simply Exiting all of Access via the Top Left X button?

Have you blocked simply closing all of the Forms, then being able to free-wheel close Access via the Top Left X button?

etc...

i'm not asking any questions yet. I am simply going to report on what I did when I'm done.

But waht I mean by logging out is to track users, in the system. The systems I make are generaly mission critical, and are used all day by the users. This login logout process helps to know who did what and when. Every record in the system logs the user and the computer they are logged into.
 

Users who are viewing this thread

Back
Top Bottom