closing database

M

mhmaid

hello friends
in my main form which is set as maximize(full screen), i have a close button
, which will prompt the user before closing.what i want is , to remove the
(x) close button which appearing in the main access window. because pressing
this will close the database directly even if pressed by mistake.

what should i do?
 
M

Marshall Barton

mhmaid said:
in my main form which is set as maximize(full screen), i have a close button
, which will prompt the user before closing.what i want is , to remove the
(x) close button which appearing in the main access window. because pressing
this will close the database directly even if pressed by mistake.


You can prevent Access from closing by canceling the Unload
event in any open form. Use a module level variable to
distinguish between your bitton and other ways of closing
the form.

Dim bolClosing As Boolean

Sub Form_Unload(Cancel . . .
Cancel = Not bolClosing
End Sub

Sub btnClose_Click()
bolClosing = True
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
 

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