Convert Error 3420 to custom message does not work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    #1

    Convert Error 3420 to custom message does not work

    I am trying to change the default error message "Object is invalid or no longer set" to a custome message.

    This error occurs when a required data is blank in the record source of the form.
    I have tried this but it does not work.

    Code:
    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Const conErrRequiredData = 3420
    
        If DataErr = conErrRequiredData Then
            MsgBox ("One of the required number was not entered.Please enter the no. first.")
            Response = acDataErrContinue
        Else
            'Display a standard error message
            Response = acDataErrDisplay
        End If
    End Sub
    Any help would be appreciated.
  • munkee
    Contributor
    • Feb 2010
    • 374

    #2
    Have you tried catching the error using different methods?

    Code:
    If Err.Number = 123 then
    ' Code to handle error 123
    End if
    I know this is doing the same as your codeu but it is worth a try
    Last edited by NeoPa; Aug 23 '10, 03:31 PM. Reason: Please use the [CODE] tags provided

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      Try Custom Error Messages.

      What you're trying now is along entirely the wrong lines I'm afraid.

      Comment

      Working...