Disable Events

I

Imran Ghani

Hi! I want to disable some events' functionlity in my MS Access Database
Programming on forms. I want to disable the Close button by writing some code
to disable its functionality so that the user may not use it. Please advise
me on it . Thanks in advance.
 
I

Imran Ghani

Thanks for your reply. I want my access form not to respond when a user tries
to exit by clicking on its close button, that is the form close at the top
right corner of the form, and also to make my form as to quit only when it
gets response from user. I mean to say the user should not be able to avoid
its query without giving a response to it.
 
M

Mr. B

Ok, now I understand that you want to not allow the user to close your form
by clicking the "X" at the top right corner of your form. I originally
thought that you had a command button on your form. Sorry for the confusion.

To remove the "X" as the top your your form open your form in design view
with the Properties dialog box displayed. The "Format" tab of the Properties
dialog box should be displayed. Set the Min Max Buttons property to No. Set
the Close Button property to No and set the What's This Button property to No.

This will remove all of the three buttons at the top right of your form,
including the "Close button", the "X".
 
E

ErezM via AccessMonster.com

hi
use the form's Unload event
it has a cancel argument you can use to block the unloading (closing) of the
form

Private Sub Form_Unload(Cancel As Integer)
If Here_Is_Your_Test_For_Allowing_Form_Close=False Then
Cancel = 1
End If
End Sub

that is, setting Cancel to any value other than 0 will cancel the event
containing it. (in this case the unload event will be cancelled)
just remember to create some ("Legal") way to close the form afterall, or he
(and you, for all that matters) will not be able to close the form at all!

good luck
erez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top