Preventing Form Close

ramhanuman

Registered User.
Local time
Today, 12:14
Joined
May 1, 2012
Messages
13
If the user clicks the close button on the top right of the form window, or the big X, I made it so that it pops up a window asking the user if they really want to exit or not. If the user clicks no, how do I prevent the window from closing? Thanks
 
Use the form's Unload event to ask the user. If the user doesn't want to close then use this line of code to cancel the unload event:
Cancel = True
 
There is no way to trap a click event on the Access window. For a form, you would use the UnLoad event.

If Msgbox("Do you really want to close this form?"),vbYesNo = vbNo Then
Cancel = True
End If
 
Pat

I think you'll find that using the code you have given, it will stop the form from closing and there by stop the app from closing as well.

I think the code you meant to post is:
Code:
If MsgBox("Do you really want to close this form?", vbYesNo[COLOR=red][B])[/B][/COLOR] = vbNo Then
Cancel = True
End If
 
I just washed my hands and can't do a thing with them:) Thanks.
 

Users who are viewing this thread

Back
Top Bottom