Message box - Save record YES NO

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I want to have a message box that appears when I close my form when data on
it has changed. I have created a command button that uses the on dirty
event although I can still click the click X at the top right corner of the
form and of course the dirty check is not performed. Is there a way to use
the forms on close event? I have tried it but errors appear because the
code is executed after the form is already closed.

The message box is similar to one that asks "This record has changed. Do you
want to save, Yes No"
YES closes the form and NO does an undo and does not close the form.

Maybe there is a better way??
 
Jeff,

I usually get rid of the X and all other methods of closing a form, then add
Cancel and Close buttons somewhere near the bottom right corner of my forms.
This way, the user has no way to close the form except through one of these
buttons, and it is very clear what they want to do, based on which button
they selected.

HTH
Dale
 
Jeff, in order to eliminate the 'x' in the upper right
corner of the message box, you will actually need to
create your own message box by using a form. Then in the
properties you are able to remove the control box and
other controls. Then what Dale is saying works well.
Many of my message boxes are made by me so the user is
restricted to what controls they can use.
*** John
 
Back
Top