How to disable the close button in access?

H

Halocarbon

I have a shared database in which users are clicking the close button "X",
when they need to close a form instead of the Command button I have created
for this purpose. Is there a way to disable the Database Close button, and
force my users to click on the command button?
 
B

Barnie

Halocarbon,

If you bring up the form properties and under 'Control Box' change from yes
to no this will take of the close button.
 
D

Dennis

Barnie's answer will also remove the Min & Max buttons. If you want those to
stay then change control box back to Yes and change the forms 'Close button'
property to No instead.
 
G

George Nicholson

AFAIK it is not possible to disable the "close Database" button. However,
the following link describes the most common workaround:
http://www.mvps.org/access/general/gen0005.htm
The idea is to set a boolean "OK To Close" variable to False at startup. It
is only be set to True when *your* close app button is clicked. It requires
a form that is always open (switchboard, a hidden form, etc.) and the state
of the OKToClose variable is checked in that form's Unload event. If the
user has followed your instructions, it closes. If not, you advise them of
the proper method and leave the db as-is. This doesn't disable the app's X
button, but it cancels the action.

HTH,
 
H

Halocarbon

I am able to disable the X's on my forms. But it is the database close
buttons I am having trouble with. I guess I am just not versed in VB enough
to understand. I have had very little experience with VB. I even opened the
sample DB like Microsoft's knowledge base example and could not even get that
to work! I will keep trying. Just wanted to let everyone know thanks for the
suggestions!
 
Top