View Single Post
  #1  
Old May 18th, 2010, 09:22 AM posted to microsoft.public.access.forms
McHammer
external usenet poster
 
Posts: 4
Default How to prevent form from closing

Hello everybody,
I use a modal popup form to enter data in a db on which there a 2 buttons
"save and close" and "cancel". I'd like to prevent the from from closing
through the "X" button on the top left corner with unwanted/incomplete data.
Do do that I trap the use of these buttons in before update event so in the
else case I put a warning msgbox (vbOKonly) and cancel = true to prevent any
other event. So far so good. After this event an extra message of Access
advises me that the record can't be saved and if I want to close anyway the
form or not. I want to avoid this message and of course the closure of the
form. Why cancel = true is not enough to do that and what else I could do?

Thks in advance