-
Im trying to make a error
handler for my program for
a overflow, err.number 6
Can someone tell me why this
doesnt work?
Code:
Public Number As Integer
Private Sub Form_Load()
ErrorTrapper
End Sub
Private Sub ErrorTrapper()
On Error GoTo ErrorHandler ' Enable error-handling routine.
Number = 2.21222222222222E+27
Exit Sub ' Exit to avoid handler.
ErrorHandler: ' Error-handling routine.
Select Case Err.Number ' Evaluate error number.
Case 6 ' "Res Index not there" error.
Exit Sub
End Select
End Sub
-
First the error occurred as your integer can't support that large number (2^15-1 is the highest)
Second your errorhandler don't work because you have err.number
Use only err
Third you should use a resume statement to get back from your procedure
-
I was trying to cause the error :)
It wasnt what you said though..
For future ref. If somebody asks this
question make should there vb is set to
break on unhandled errors, not ALL errors.
Thanks :)