I have the following behind my form:
InputMaskMsg is in a Module and is a standard message to be displayed in many forms.
What I would like to do is an undo on the control that is causing the error so the user doesn't have to do anything. But I don't know which control to undo if there are several controls with an InputMask.
Is there a way to use the CurrentControlName that I'm capturing? I tried to use CurrentControlName.Undo but it tells me this is an "Invalid qualifier".
Thanks in advance for any advice.
Debbie
Code:
Dim CurrentControlName As String
Private Sub DateHired_Enter()
If Len(Me.DateHired & vbNullString) = 0 Then
Me.DateHired.SelStart = 0
End If
'remembers last control user was in while editing
CurrentControlName = "DateHired"
End Sub
Private Sub SSN_Enter()
If Len(Me.SSN & vbNullString) = 0 Then
Me.SSN.SelStart = 0
End If
'remembers last control user was in while editing
CurrentControlName = "SSN"
End Sub
Private Sub Form_Error(DataErr As Integer, Response As Integer)
' MsgBox DataErr
Select Case DataErr
Case 2279 'InputMask violation
InputMaskMsg
Response = acDataErrContinue
Case Else
'unexpected error. display default error message
Response = acDataErrDisplay
End Select
End Sub
What I would like to do is an undo on the control that is causing the error so the user doesn't have to do anything. But I don't know which control to undo if there are several controls with an InputMask.
Is there a way to use the CurrentControlName that I'm capturing? I tried to use CurrentControlName.Undo but it tells me this is an "Invalid qualifier".
Thanks in advance for any advice.
Debbie