G
Guest
I am trying to put up a Message Box on Form_Close, and I think I've got most
of it working, but I am unsure of the syntax for the "Cancel" button. Can
one of the experts review my code below and tell me what I'm missing? (See
Below)
I appreciate your help in advance.
Cheers,
Leslie
Private Sub Form_Close()
Dim iQuit As Integer
If Not IsNull("Me![VendorID]") Then
IQuite = MsgBox("Do you want to Save before Exiting? Yes to Save, " _
& "No to Quit without Saving or Cancel to return to the form.", _
vbYesNoCancel, "Vendor Update")
Cancel = False
If iQuit = vbCancel Then
DoCmd.Restore
End If
If iQuit = vbYes Then
DoCmd.Save
End If
If iQuit = vbNo Then
Me.Undo
' DoCmd.Close
End If
Else
DoCmd.Close
End If
End Sub
of it working, but I am unsure of the syntax for the "Cancel" button. Can
one of the experts review my code below and tell me what I'm missing? (See
Below)
I appreciate your help in advance.
Cheers,
Leslie
Private Sub Form_Close()
Dim iQuit As Integer
If Not IsNull("Me![VendorID]") Then
IQuite = MsgBox("Do you want to Save before Exiting? Yes to Save, " _
& "No to Quit without Saving or Cancel to return to the form.", _
vbYesNoCancel, "Vendor Update")
Cancel = False
If iQuit = vbCancel Then
DoCmd.Restore
End If
If iQuit = vbYes Then
DoCmd.Save
End If
If iQuit = vbNo Then
Me.Undo
' DoCmd.Close
End If
Else
DoCmd.Close
End If
End Sub