Access VBA - 取消表单错误事件?
Access VBA - Cancel form Error event?
我已经为我的字段之一设置了此代码(输入掩码违规):
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const INPUTMASK_VIOLATION = 2279
If DataErr = INPUTMASK_VIOLATION Then
MsgBox "You didn't fill the data correctly !", vbCritical
Response = acDataErrContinue
End If
End Sub
现在,在同一个表单上我有撤消按钮。当我违反输入掩码并单击撤消按钮时,此 Inputmask_Violation 消息框不断弹出。在我正确填写字段中的数据之前,我不允许我取消脏数据。
单击“撤消”按钮时是否有取消此操作的选项?
我的撤消按钮代码:
If Me.Dirty Then Me.Undo
看来这做不到,我尝试了不同的变体。输入掩码违规是 运行 次错误,因此它发生在每个 VBA 事件之前。
我已经为我的字段之一设置了此代码(输入掩码违规):
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const INPUTMASK_VIOLATION = 2279
If DataErr = INPUTMASK_VIOLATION Then
MsgBox "You didn't fill the data correctly !", vbCritical
Response = acDataErrContinue
End If
End Sub
现在,在同一个表单上我有撤消按钮。当我违反输入掩码并单击撤消按钮时,此 Inputmask_Violation 消息框不断弹出。在我正确填写字段中的数据之前,我不允许我取消脏数据。
单击“撤消”按钮时是否有取消此操作的选项?
我的撤消按钮代码:
If Me.Dirty Then Me.Undo
看来这做不到,我尝试了不同的变体。输入掩码违规是 运行 次错误,因此它发生在每个 VBA 事件之前。