我已经为我的一个字段设置了这个代码(输入掩码冲突):
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_Folation消息框会不断弹出。在正确填写字段中的数据之前,我不允许取消脏数据。
当我单击"撤消"按钮时,有任何取消此操作的选项吗?
我的撤销按钮代码:
If Me.Dirty Then Me.Undo
看起来这是不可能的,我尝试了不同的变量。输入掩码冲突是一个运行时错误,因此它发生在每个VBA事件之前。