Closing Access

D

Duane

I have a split database. On the frmSwitchboard form I have a CmdExit button
that closes all the forms and recorsets which are connected to the backend,
then uses the DBEngine to compact and backup the database.

Since there are several frontends to this database, I would like to know if
there is a way to force people to use the CmdExit button to exit the
database rather then using the default Windows X button that is located in
the top right corner of the Access container? Can the Close button be
removed or disabled? I know it can be removed from forms, but I haven't
seen or read anything about being able to remorve it from the application.

Can a function be used to run the CmdExit code if the button is clicked?

Any help would be greatly appreciated. Thanks in advance.
 
D

Duane

Thanks you very much Daniel. That is perfect. I like removing the entire
controlbox when the application is opened. Gives much more control. I like
to try and understand the code I copy but this is way over my head at this
time.

Thanks again....
 
D

Dennis

The way I do it is to put the following extra code in you cmdExit button
Me.Tag = "OK"

In the form Unload event you can then put the following
If Me.Tag <> "OK" Then
Cancel = True
End if

This means they can only close the form or indeed access itself by pressing
your exit button.
 
Top