Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Florence, Oregon, USA
    Thanked 0 Times in 0 Posts

    User error handling doesn't work (VBA Access2003/WindowsXP)

    User error handling has suddenly stopped working in programs that have not been changed in months. As shown in the example below, the code all contains a "On Error Goto ErrorHandler" statement at the beginning of the applicable procedures, and the unchanged error handlers have all worked fine in the past. Now, when any error occurs, the "On Error Goto..." statement is ignored and control passes to the standard all-purpose VB error handler that displays "Run-time error 'nn': etc. It does not matter what error occurs, my error handlers are never given control.

    As it was VBA for Access that was failing, I moved this code to the VBA for Excel environment. It also failed as described above. I even re-typed in the code; it still failed in all VBA environments.Then, as a last resort, I moved it to VB Express 2005. It worked fine. The following code example is the simplest way I could show the problem.

    Sub TestRaiseError()

    On Error GoTo ErrorHandler

    Err.Raise 76

    Exit Sub

    Select Case Err.Number
    Case 76 ' Path not found
    MsgBox "Error number 76"
    Case Else
    MsgBox "Else Error number " & Err.Number
    End Select
    Resume ErrorHandlerExit

    End Sub

    Does anyone see where I could have created an environment where this failure would start happening? Or is there anything common to all VBA environments that, being corrupted, could be causing this?

    Thanks to anyone who puzzles this out.

    John Littell

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: User error handling doesn't work (VBA Access2003/WindowsXP)

    Does <post:=515,902>post 515,902</post:> help?

Posting Permissions

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