Coding the X Close button on the Form Windows

dungstar

Registered User.
Local time
Today, 22:19
Joined
Mar 13, 2002
Messages
72
Is it possible to code the form window's X Close button in the upper right hand corner?

I want the user to have the normal windows control but I wish to enforce some background code to properly code the form like I have with a cmdClose button on the form. I'm wondering if it's possible to copy that code onto the X window close button as well.

Thanks!
 
Put your code for your button in the form's OnClose Event. Then, refer the button's OnClick Event to that same procedure.
 
Duh... can't believe I didn't think of that. Thanks!
 
I have tried this on a registration form I made with the code
If msgbox("You have chosen to close, Is that correct?",vbyesno)=vbyes then
docmd.close
else
'dont close
end if

exit sub

Where the dont close is I have tried everything to try and stop the form closing without success. Any suggestions?
Dave
 

Users who are viewing this thread

Back
Top Bottom