[AccessD] Capturing the application's Close event

John W. Colby jcolby at colbyconsulting.com
Thu Dec 4 10:08:05 CST 2003


One way to do this is to:

1) Create a global blnAllowClose
2) Open a form hidden.
3) In the form OnClose place a

	Cancel = blnAllowClose

4) Set blnAllowClose = false when the form opens.
5) In your app, in the button or whatever you use to close the database, set
blnAllowClose = true

It turns out that Access can't close when an object remains open.  By
setting up the hidden form and not allowing it to close until your global
variable says it can, you have effectively prevented the form from closing,
which prevents ACCESS from closing.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Christopher
Hawkins
Sent: Thursday, December 04, 2003 10:59 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] Capturing the application's Close event


Hola!

I have inherited an Access application (those words alone should
alert you that nothing good is going to follow in this message) that
is exhibiting strange behavior when the user exits by clicking the
Close button on the Access shell.

I'd like to be able to capture and stop the Close process when the
user attempts to exit this way.  I have Googled, but to no avail.

Anyone know how to do this?

-Christopher-


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list