Shamil Salakhetdinov
shamil at users.mns.ru
Fri Jan 26 10:59:23 CST 2007
Hello John, You found how to get module name in design mode i.e. module name of a module opened in VBE's IDE... Unfortunately there is no way to get module name of running function/sub/property on runtime: they have to be hardcoded - to avoid retyping module name and sub/function/property name use symbolic constants as in the following example: Test Module ============ Private const moduleName as string = "testModule" Function test1() On error goto handleErr Const procName as string = "test1" ... Exit function handleErr: runtimeError Err, moduleName, procName ... End function Function test2() On error goto handleErr Const procName as string = "test2" ... Exit function handleErr: runtimeError Err, moduleName, procName ... End function ... RunTime Error Reporting module ============================== Public sub runtimeError( _ byref errObject as object, _ byval moduleName as string, _ byval procName as string ) Msgbox errObject.Number + " - " + _ errObject.description + " in " + _ moduleName + "." + procName End sub -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits Sent: Friday, January 26, 2007 7:31 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Module Name - UPDATED Actually, I found I could get the module name by using: Application.VBE.ActiveCodePanel.CodeModule So there must be a way to get the function. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell Sent: Friday, January 26, 2007 11:08 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Module Name - UPDATED On 1/26/07, John Skolits <askolits at ot.com> wrote: > > Actually I wanted the function name, not the module name. I know how to get > the module name. > > ---- > > Anyway to retrieve the name of the module you're code is running in. > > I want to have an email sent to me in the error trap if there is a failure > and want it to send me the name of the module. I could just type in the name > in a text string, but I want to use this in a bunch of modules and would > rather have something generic like " CurrentModule.name" AFAIK, no. You have to hard code the function and module name into the error handler. -- Bryan Carbonnell - carbonnb at gmail.com Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "What a great ride!" -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com