A
Andy Millar
Hi
I'm using the following code (courtesy of this group) to display a
message when closing a form. This allows the user to either continue to
close and save data, close and not save, or go back to the form. It
works OK except when they click cancel. Ideally it should just cancel
the event and take them straight back to the form, but another Access
error message box pops up saying "You can't save this record, an error
has occurred" (the actual message is longer than that). They then have
to choose "no" to go back to the form.
How do I stop that error message coming up?
Here is my code
Select Case MsgBox("Would you like to save your changes?",
vbYesNoCancel + vbQuestion)
Case vbYes
'do nothing
Case vbNo
Me.undo
Case vbCancel
Cancel = True
End Select
Any help much appreciated! - Andrew Millar
I'm using the following code (courtesy of this group) to display a
message when closing a form. This allows the user to either continue to
close and save data, close and not save, or go back to the form. It
works OK except when they click cancel. Ideally it should just cancel
the event and take them straight back to the form, but another Access
error message box pops up saying "You can't save this record, an error
has occurred" (the actual message is longer than that). They then have
to choose "no" to go back to the form.
How do I stop that error message coming up?
Here is my code
Select Case MsgBox("Would you like to save your changes?",
vbYesNoCancel + vbQuestion)
Case vbYes
'do nothing
Case vbNo
Me.undo
Case vbCancel
Cancel = True
End Select
Any help much appreciated! - Andrew Millar