C
CTJ
I need to understand how when creating a vbYesNo message box, how I assign
the next part of the code dependent on the Yes/No answer.
Simply put, from a command button, the YesNo message presents itself. On
clicking yes I want to Close the form without saving any record. On No, I
want to leave the form open.
My code is as follows:
MsgBox "Are you sure you want to close this Form?", vbYesNo, "Form will
close......?"
If vbNo Then
DoCmd.CancelEvent
Else
DoCmd.Close
End If
When I click no, the form stays open, when I click yes, the form stays open.
Thanks for assistance
the next part of the code dependent on the Yes/No answer.
Simply put, from a command button, the YesNo message presents itself. On
clicking yes I want to Close the form without saving any record. On No, I
want to leave the form open.
My code is as follows:
MsgBox "Are you sure you want to close this Form?", vbYesNo, "Form will
close......?"
If vbNo Then
DoCmd.CancelEvent
Else
DoCmd.Close
End If
When I click no, the form stays open, when I click yes, the form stays open.
Thanks for assistance