Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function name

Status
Not open for further replies.

ecucurella

Programmer
Feb 17, 2003
34
ES
Hi all,
Is there a way to know the function name to print this in a log file?
Now if there is an error I print:

...
If blnLog Then PrintToLog("ERROR|myfunctionname|" & err.number & "|" & err.Description & "|" & err.Source)
...

But I have to manually write the 'myfunctionname' in all of the functions I have in my project.
I need something like:

...
If blnLog Then PrintToLog("ERROR|"& function.name &"|" & err.number & "|" & err.Description & "|" & err.Source)
...
???

Thank you,




 
One way is to set a global variable. At the start of each function, set the variable to be the name of the function you are currently accessing.

In you logPrint call then call the value for this variable.

I'm sure there are easier ways, but this is your starter for 10.

Good luck

BB

 
You could download the addin MZTools at it allows you to insert error handling with the click of a toolbar button and it allows you to customize the error handling script with keywords such as PROCEDURE_NAME, PROCEDURE_TYPE, MODULE_TYPE, etc. With this I believe you could accomplish what you are after and it's free.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top