Link to home
Create AccountLog in
Avatar of abangbatax

asked on

trap or catch or locate where is my error code

Hi experts,

I would like to ask how to trap or catch or locate where is my error code,

i have compiled a software but got error on some event, after i check the code i cant find the mistake
this can take a lot of time.

Can you give me solution for this?

Avatar of FSWZach

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of abangbatax


My code is more then 700 lines, making number on each line will take a lot of time.

Is this the only way?
Avatar of jaynee
What development environment are you using?  Can you run within the environment so that the builtin debugger shows you where the error is occurring?

If not, abangbatax has given you a good solution - but you don't have to put in every line number to start with.  You should be able to tell from the running program approximately where in the code the error is.  Try putting in a few MsgBox statements at the start and ends of procdures to narrow it down, then when you find the procedure that's falling over, use the line numbers.

I hope you don't have procedures that have hundreds of lines of code, otherwise you might need to think about rewriting them to be smaller : )
Also - when using numbers - you do not need to number every line

Just whatever the last number is what is reported

So if you went

100 ......



102 .....

And the error is as above - it will kick back line 100