[AccessD] exiting Access

Dan Waters dwaters at usinternet.com
Sat Jul 10 13:49:56 CDT 2004


How about an invisible form which contains the code in the Unload event?
Open it by code when the app is first opened, and that should take care of
things!

Dan

-----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:40 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] exiting Access

OK, clever -- I guess that may be what JC was really referring to -- 

But what if you don't use or want a main form? I really think I've done this
some other way -- but then, maybe not. 

Susan H. 

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

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

-- 
_______________________________________________
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