[AccessD] exiting Access

Dan Waters dwaters at usinternet.com
Sat Jul 10 13:35:14 CDT 2004


Susan,

Yes - It's easy!

When your app opens, set a global Boolean variable to False.

	GblnAllowClose = False

In your main form's Unload event, enter the following code:

    If GblnAllowClose = False Then
        Cancel = True
    End If

The above will not allow the main form to close, thus keeping the
application open.

Now put the following code in the Exit button's click event.

	GblnAllowClose = True
	Docmd.Quit

I've used this for a long time, and it works very well.

Dan Waters

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Saturday, July 10, 2004 1:13 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] exiting Access

This ought to be simple, but I'm drawing a total blank -- 
 
Seems like you ought to be able to trap the File Exit and clicking the
application's Close button -- so you can prevent the user from closing the
application before they should. 
 
Susan H. 
-- 
_______________________________________________
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