[AccessD] A2K: Get Current Sub Name

Haslett, Andrew andrew.haslett at ilc.gov.au
Thu Nov 13 22:21:32 CST 2003


Don't know of any inbuilt function, but another (painful) workaround..

Since you must know the name when you call it, I guess you could include an
'optional' parameter in each sub you are using and calling it this way..

*********************************
Call MySub('MySub')
*********************************

Then for your actual Sub:

*********************************
Sub MySub (Optional myName as string)

     Debug.Print ("My name is " & myName)

End Sub
*********************************

Cheers,
Andrew

-----Original Message-----
From: Stephen Bond [mailto:stephen at bondsoftware.co.nz]
Sent: Friday, 14 November 2003 1:11 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] A2K: Get Current Sub Name


Darren

A common way to do this (this means I saw a guru do it so I copied him <g>)
relies on inserting in each module at initial design time the following line
of code:

Private Const thisModuleName As String = "basWhatever"

Not very swept up sorry!

Stephen Bond



> -----Original Message-----
> From: Darren DICK [mailto:d.dick at uws.edu.au]
> Sent: Friday, 14 November 2003 2:35 p.m.
> To: AccessD List
> Subject: [AccessD] A2K: Get Current Sub Name
> 
> 
> Hello all
> Is there a way to determine the current sub name once you are 
> in it then display it
> Is there a Current Sub Property? etc
> 
> eg  (PSEUDO Code)
> Private Sub MySub()
> Msgbox "My Sub Name is " & Application.SubName
> End sub
> 
> Many thanks in advance
> 
> Darren
> 
> _______________________________________________
> 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

IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.


More information about the AccessD mailing list