Getting info when trapping errors??? 
Author Message
 Getting info when trapping errors???

This may be wishful thinking but...

When an error occurs is there a way to :

        1) obtain the name of the form or module that the error occurred in ?
        2) obtain the name of the function of sub that the error occurred in ?
        3) obtain the line number of the code that caused the error ?

I'm attempting to add some robust general error handling functionality to
my application and it would be nice to show this information to users when
an unexpected error occurs.  

Thanks in advance

Jorge



Sun, 25 Jun 2000 03:00:00 GMT  
 Getting info when trapping errors???

Check out the Err object in help. I think you'll find what you're looking
for.

Quote:
>    1) obtain the name of the form or module that the error occurred in ?
>    2) obtain the name of the function of sub that the error occurred in ?
>    3) obtain the line number of the code that caused the error ?



Sun, 25 Jun 2000 03:00:00 GMT  
 Getting info when trapping errors???

Jorge,

Quote:
> When an error occurs is there a way to :

>    1) obtain the name of the form or module that the error occurred in ?
>    2) obtain the name of the function of sub that the error occurred in ?
>    3) obtain the line number of the code that caused the error ?

The easiest way is to store the above information in some variables when
you enter a function. If an error occurs, you'll have the info handy.

By the way, there was an error handling contest on the Access Developer
Network. Check out http://www.wji.com/access/w1002015.html. -- Tom

_____________________________________
Tom Jordan
TriniDat Software-Entwicklung GmbH
Datenbanken, Internet, Multimedia.
Individual-Software zu Festpreisen.

www.fullAccess.de



Mon, 26 Jun 2000 03:00:00 GMT  
 Getting info when trapping errors???

Quote:

> This may be wishful thinking but...

> When an error occurs is there a way to :

>         1) obtain the name of the form or module that the error occurred in ?
>         2) obtain the name of the function of sub that the error occurred in ?
>         3) obtain the line number of the code that caused the error ?

> I'm attempting to add some robust general error handling functionality to
> my application and it would be nice to show this information to users when
> an unexpected error occurs.

> Thanks in advance

> Jorge

As Tom Jordan said there was an error handling contest on the Access
Developer Network.  I liked the CreateErrorStub example provided by
Donald Bradey but I changed the code generator in Fragment(11) which
generates the Msgbox on the next line.

    Fragment(11) = TabChar & "MsgBox " & "Application.currentobjectname
&" & Chr$(34) & " - Error in " & ProcName & "()" & ".  " & Chr$(34) & "
& Error$" & "&" & Chr(34) & "  Err No:  " & Chr(34) & " & Err , 16"

    MsgBox Application.currentobjectname & " - Error in
FillDownFsnDssn().  " & Error$ & "  Err No:  " & Err, 16



Mon, 26 Jun 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. trapping info in an error message

2. Getting Line number for error trapping routine

3. Getting Line number for error trapping routine

4. onerror trap doesn't trap error!

5. Info trapped in Buffer

6. Info trapped in Buffer

7. Trapping file sharing errors w/o ON ERROR?

8. DAO Error Trapping & Most Common Errors

9. Deadlock errors & vb error trapping

10. on error (trapping error)

11. Custom 500 error page - trapping the error text?

12. Breaks on error even when error trapping set to break on unhandled

 

 
Powered by phpBB® Forum Software