Hi,
I am using "On Error GoTo ErrorHandler", Is there a way to find out in exactly in What command the error has occured?
The line number?
Regards
Printable View
Hi,
I am using "On Error GoTo ErrorHandler", Is there a way to find out in exactly in What command the error has occured?
The line number?
Regards
Hello Tiovital,
I allways removing temporary the "On Error" statement.
Lets happen the situation where the error occures. Vb will show you the error line.
Michelle.
I use the following to 'break in' to the code on an error. Insert a zero and comment out the handler Label.
On Error GoTo 0 'Error_handler
Then when I'm done, I delete the (0 ') and use my error handler.
You can find the description of an Error, use the Err object and track it down judging by what each statement does.
Code:On Error GoTo ErrorHandler
'Generate an Error
Err.Raise 6
Exit Sub
ErrorHandler:
'Display a MessageBox with a description of the Error
MsgBox Err.Description
Hi,
Thanks for the info, But i know all that, I just want to know if there is a method to know - in run time - the problematic line, Thats all.
Regards
Tiovital, VB automatically select the line in which the error occured, as Michelle said.
And Megatron's way should tell you what error it was that occurred. If you want to know the number of the error the occured, than use Err.Number.
[Edited by Matthew Gates on 08-08-2000 at 01:55 AM]Code:On Error GoTo ErrorHandler
Error 6
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & Chr(58) & Chr(32) & Err.Description
Matthew,
Can You tell What line-number Faild? What instracution number failed? (not the err.number)
Using Labels you can determine the error line on which error was caused
Code:Private Sub Form_Load()
On Error Resume Next
15: Err.Raise 10
MsgBox Erl
End Sub