在本示例中,如果 A 字段的值为"是",则会取消 Delete 事件。
图 示:
源 码:
Private Sub Form_Delete(Cancel As Integer)
' Check the value of the DataRequired field.
If Me.A = "Yes" Then
' Cancel the record deletion.
Cancel = True
' Notify the user.
MsgBox "Cannot Delete the Record."
End If
End Sub