Results 1 to 3 of 3

Thread: [RESOLVED] Error Handling

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Resolved [RESOLVED] Error Handling

    Code:
    Private Sub Form_Load()
    On Error GoTo Error_
    
    SOME OTHER CODE NOT RELEVANT
    
    Error_:
    MsgBox "Error No : " & Err.Number & vbCrLf & "Error Description : " & Err.Description, vbCritical, "Error No." & Err.Number
    Resume Next
    End Sub
    When i run this program i always get an error no. 0 and no description even though there is no error.

    I think the program just shows the message box when its not suppose to how do i stop it doing it.

    Thanks in advance chris1990
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Error Handling

    The label (Error_) doesn't actually do anything other than provide a place to "jump" to.

    To stop the error handler running every time, simply place "exit sub" on the line before it.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Re: [RESOLVED] Error Handling

    thanks
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

Posting Permissions

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



Click Here to Expand Forum to Full Width