Team LiB
Previous Section Next Section

CancelEvent

Cancels a cancelable event (an event that has a Cancel parameter).

Syntax

DoCmd.CancelEvent()

Example

The following example displays a dialog asking the user whether he or she wants to save changes to a record. If the user clicks the No button, then the CancelEvent method is called to cancel the update.

Private Sub Form_BeforeUpdate(Cancel As Integer)
   If MsgBox("Are you sure you want to save changes to this record?", _
              vbYesNo Or vbInformation, "Confirm Upate") = vbNo Then
      DoCmd.CancelEvent
   End If
End Sub

Comments


Team LiB
Previous Section Next Section