Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Got the knack of creating a custom error message to replace the default on, but am stuck on how to address multiple error codes. Current code is:

    Private Sub Form_Error(DataErr As Integer, Response As Integer)

    Const conErrRequiredData = 3314

    If DataErr = conErrRequiredData Then
    MsgBox ("Hey dummy, you forgot..." _
    Response = acDataErrContinue

    Else

    'Display a standard error message
    Response = acDataErrDisplay

    End If

    End Sub

    But I am also getting 2 field with errors to code 3101. I have tried changing:

    Const conErrRequiredData = 3314 Or 3101

    or also tried
    Const conErrRequiredData = 3314 And 3101

    but neither work. They either allow the 3101 fields to default to the "default" error message, or I get a code error.

    Thanks in advance for an assistance.


  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts
    I would use a Select Case statement in your error handling code as follows
    Code:
    Select Case DataErr
         Case 3314
              'Display 3314 error message
         Case 3101
              'Display 3101 error message
         Case Else
              'Display standard error message
    End Select
    Wendell

  3. #3
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    141
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks Wendell, that did it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •