Do we have access to the close event of the database

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

HI!!
I would like to know if I can show a message to the user
(programmaticaly) when he click's on the 'X' button of the
window in access.(The one that allows him to quit the
current application he's in.)
The message would be a Yes/No. Yes, he can quit. No, he
stays in the application.

Can sonething like this be done?
P.S. I'm not refering to a regular form here.

Does anyone have any ideas on how to achive this.
Any help will be appreciated.
thanx in advance,
Patrick
 
Patrick said:
HI!!
I would like to know if I can show a message to the user
(programmaticaly) when he click's on the 'X' button of the
window in access.(The one that allows him to quit the
current application he's in.)
The message would be a Yes/No. Yes, he can quit. No, he
stays in the application.

Can sonething like this be done?
P.S. I'm not refering to a regular form here.

Does anyone have any ideas on how to achive this.
Any help will be appreciated.
thanx in advance,
Patrick

There is no such event, but when Access (or the current file) is closed,
the close events of all forms that are open do fire. You can open a hidden
form at startup that stays open the entire time a user is in the app and
use its close event to do whatever you need when they close the application
or Access.
 
There is no Close event for the application.

The nearest workaround is to open a (hidden) form, and use its Close event.
 
Thank you for this piece of advice, from the both of you.
I will give that hidden form a try...
 
HI again!!
I've created my hidden form and its loaded as soon as I
load the application,and When I close the application, it
shows me the message I want to see.
MY PROBLEM is that I'm not sure on how to proceed to
cancel the QUIT that has been activated once that form has
the control.Here the code:

If MsgBox("You're about to close this application, " _
& "" & vbNewLine & "Is this what you want to do?
(Yes/No)", vbYesNo, "PWGSC -Attention") = vbYes Then


Else
' here I want to give focus to this form. But its not
working. It transforms itself into a loop....
DoCmd.OpenForm "TestForm1"

End If
CAn someone tell me how to properly deactivate the FINAL
close if the user chooses to?

thanx again!!
Pat
 
Assuming that you put that code in the form's Unload event (not its Close
event), simply set Cancel = True if you don't want the form to close.
 
Back
Top