closing my application throught my command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
there's a way to avoid user to close the application by hitting the 'X' on
the Access main screen?
I have built a form which will act as a Control Panel for all my application
and there's a command button "log off" which will quit the application
performing some manteinance stuff.
But if the users skipps it by closing Access through the 'X' my procedure
wont run.
Thanks in advance

Rocco
 
quit the application
performing some manteinance stuff.

The only real way to trap the Application.Close event (which doesn't exist)
is to create a hidden form and use its OnUnload event to do your close-down
procedures.

HTH


Tim F
 
Thanks Tim,
since my Control Panel form stays opened all the time, I can just copy my
manteinance procedure in its onclose event. Right?
 
since my Control Panel form stays opened all the time, I can just copy
my manteinance procedure in its onclose event. Right?

Um. Since it's quite easy to close a form from the UI this is probably
not a good thing if continuing to use the database afterwards would be
dangerous. A number of possibilities (but bear in mind that I've not had
occasion to do any of these):

1) finish the tidy-up code with a DoCmd.Quit action so the user doesn't
have a database to mess with any more.

2) go through all the attached TableDefs and empty the Connect string,
thus breaking the connection to the live data.

3) the advantage of a hidden form is that the user really has to go out
of her way to unhide it and close it; so if someone is being that bloody-
minded you can make it a disciplinary matter.

Just a thought...

All the best


Tim F
 
Back
Top