How do I capture the access vba sub/function name at runtime?

V

vince6501

I am using Access 2003. I would like to setup an error logging routine and
in that routine, I want to log to subroutine or function name that caused the
error. Is that data available at runtime?
 
M

Marshall Barton

vince6501 said:
I am using Access 2003. I would like to setup an error logging routine and
in that routine, I want to log to subroutine or function name that caused the
error. Is that data available at runtime?


Regretably, it is not.

The usual approach is for each procedure to identify itself
via an argument to the general logging sub.
 
K

Klatuu

I would suggest you call the logging routine from your normal error handling
routines and pass it the name of the procedure and maybe the error number:

Err_cmdSomeButton_Click:
Call ErroLogger(Me.Name, "cmdSomeButton_Click", Err.Number)
 
V

vince6501

Yes, that is what I am doing, but I was hoping that there was a better (more
general) way. Thanks for you reply.
 
G

gabor123

Try the application.CodeContextObject Property
rgds gabor

„vince6501†ezt írta:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top