John W. Colby
jcolby at colbyconsulting.com
Thu Nov 13 23:07:30 CST 2003
Darren, The VBEErrorHandler error handler wizard can do this for you but as everyone else is stating, it isn't pretty. There seems to be simply no way to just "know" the function name, no variable you can go to etc. Ken Gets et al (ADH) uses two classes, one that holds info about the current sub and another that holds a collection of those classes. IOW, code is inserted in each function which instantiates a class on entry and tears it down on exit. These are stored in a collection. What this gives you is a very slick call path, i.e. how did I get here? Or that's the theory anyway. Given the asynchronous nature of Access, with code running and then the user clicking on things, email being received and firing outlook events etc. I think this whole concept could get confusing real fast. But it exists if you want to look at it. Go to DatabaseAdvisors.com and go to the downloads. http://www.databaseadvisors.com/downloads.htm click VBErrorHandler and install it. I use it daily for my error handlers anyway, the call stack tracing is just a little bonus I threw in when I specifically needed it once. John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Darren DICK Sent: Thursday, November 13, 2003 8:35 PM 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