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!

Return name of procedure in which code is running 2

Status
Not open for further replies.

Remou

Technical User
Sep 30, 2002
13,030
BE
Hi
I would like to include the name of the current procedure in an error message. The module in which the code resides is not a class module, so I can't use codecontextobject or me (I think). I would like something comparable to me.module.name, does anyone know of anything? Thanks.
 
It is not possible to query the stack to get the name of the currently excuting procedure, be it in a form, class, or module.

I would suggest that from within each procedure that you have error handling enabled, you call a general error handling function, passing the name of that procedure as a parameter.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Hi,
Actually, this is possible if you declare a string variable, then set the value inside each module and subroutine (perhaps this could be called strModuleName). Then, as soon as the code segment starts, set the variable immediately (e.g., strModuleName = "Sub: cmdRunReport_click"). The strModuleName can then be added to your error message.
Personally, I would declare this string variable in the General Declarations section of a module, so that it becomes available to the entire database as a global (or public) variable. To keep from getting confused, each form, report, and module will need to set this value.

HTH, [pc2]
Randy Smith, MCP
rsmith@cta.org
California Teachers Association
 
Thanks for these posts. No wonder I spend all day checking micro$oft help and getting no where!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top