handle errors 2279 & 2113 within form error trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mseo
    New Member
    • Oct 2009
    • 183

    handle errors 2279 & 2113 within form error trigger

    hi,
    I have a problem errors handling
    I use this trigger code for handling an error (2279)
    but I can not handle more than one error using this code
    I tried this syntax within the below mentioned code
    Code:
    Const INPUTMASK_VIOLATION = 2279 & 2113
    but it doesn't work at all
    Code:
    Private Sub Form_Error(DataErr As Integer, Response As Integer)
       Const INPUTMASK_VIOLATION = 2279
       Dim Msg As String
       If DataErr = INPUTMASK_VIOLATION Then
          Select Case Screen.ActiveControl.Name
             Case "homePhone"
                Beep
                MsgBox "The phone you entered is invalid!", vbCritical
                Me.HomePhone.Undo
             [B]Case "BirthDate"[/B]
                Beep
                MsgBox "The birth date you entered is invalid!", vbCritical
               Me.BirthDate.Undo
             Case Else
                Beep
                Msg = "an error"
                MsgBox Msg & Screen.ActiveControl.Name & "!"
                Me.Undo
          End Select
          Response = acDataErrContinue
         End If
    End Sub
    I need to handle more than one error in the same form using this syntax because it defines the fields that causes the error
    I appreciate any suggestion
    thank you very much
  • Dan2kx
    Contributor
    • Oct 2007
    • 365

    #2
    Would this work?

    Code:
    Const INPUTMASK_VIOLATION = 2279
    Const INPUTMASK_VIOLATION2 = 2113 
       Dim Msg As String 
       If DataErr = INPUTMASK_VIOLATION OR _
          DataErr = INPUTMASK_VIOLATION2 Then 
    .........

    Comment

    • mseo
      New Member
      • Oct 2009
      • 183

      #3
      thank you
      it works great
      appreciate your help

      Comment

      Working...