Avatar of mlcktmguy
mlcktmguy
Flag for United States of America asked on

How to Pass Line Number to Error Handler in MZ Tools

I used MZ Tools to create and implement a standard error handling routine in my application.

The code I currently insert into a respective module by the MZ Tools error handler.  Looks like this:


'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------
                               If isDeveloper then
                               Else
                                 On Error GoTo $P[CODE_ELEMENT_NAME]_Error    
                               EndIf
'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------

$P[METHOD_BODY]

'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------
                               On Error GoTo 0
                               Exit $P[CODE_ELEMENT_KIND_KEYWORD]
                               $P[CODE_ELEMENT_NAME]_Error:
                               sysErrorHandler Err.Number, Err.Description, "$P[CODE_ELEMENT_NAME]", "$P[PARENT_CODE_ELEMENT_NAME]", "$P[CODE_ELEMENT_KIND_KEYWORD]"
'- - - - - - - - - - - - - - - - - - - - - - - - - - G E N E R A T E D  E R R O R  C O D E ----------------
'



I am getting an error code from a module.  My current error logic tells me the module and subroutine(or function) where the error occurred but not the line number

I can use MZ Tools to put line number on all of the statements.

My question is is:  How to I pull the line number of the line where the error occurred?
Microsoft Access

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

User the ERL function

... error occurs

Error trapping code
Debug.Print erl
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jim Dettman (EE MVE)

Just a side note; it's an un-documented function and the full reference is VBA.erl

Jim.
mlcktmguy

ASKER
Thanks
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Jim ... undocumented ?
I typed erl into the VBA immediate window, hit F1 and ...

ERL
Jim Dettman (EE MVE)

yes, the err object is, but never the VBA.ERL call to my knowledge.

Jim.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

OOPS ... umm ... I saw err as ERL ... lol. My bad
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.