Do something when the database is closed

accessman2

Registered User.
Local time
Today, 15:12
Joined
Sep 15, 2005
Messages
335
Hi,

I want make to run a function when the database application is closed. When the user close the database application using Ctrl+Alt+Delete keys, I want the function to run it at that moment. How can I make that?
If I create a hide form and put the function of the Close_Event, it will work when the user close the database application using legal way. However, the user will use Ctrl+Alt+Delete to close the database application, then the function will not run it.

Does anybody how to solve it?
 
Hi,

I want make to run a function when the database application is closed. When the user close the database application using Ctrl+Alt+Delete keys, I want the function to run it at that moment. How can I make that?
If I create a hide form and put the function of the Close_Event, it will work when the user close the database application using legal way. However, the user will use Ctrl+Alt+Delete to close the database application, then the function will not run it.

Does anybody how to solve it?

In short, no, you cannot do this. When an application is closed via the task manager it is stopped...IMMEDIATELY. No other code is going to be run by that application, in addition closing a database this way is a good way to cause corruption.

There are APIs that allow you to check the keyboard input and message ques so I suppose you could look for when a user hits CTRL+ALT+DELETE but you'd only know that they pressed those keys, not that they intended to close the database.
 
You will have to hook into the windows messaging to catch when the ctrl + AT + DEl is pressed. You will have to make numerous API calls so this should be done by an expert user others Access otherwise you could run into troubles.
 
And out of curiosity, why would anyone use the three finger salute to close your DB? What issues are they getting that force that? It sounds like the ctrl-alt-delete closure is a symptom of a bigger issue, and the cure, if you will, is not catching the keypress, but preventing its necessity in the first place.
 

Users who are viewing this thread

Back
Top Bottom