Reference to object calling a function...

J

JP

Hello,

Simple question; how do I find out what object called/triggered a function?
I apologize if this question has already been asked (I am sure it has) but I
cannot seem to find an answer on the discussion group.

All I could find so far is that Excel has an Application.Caller variable but
this does not seem to be available in Access VBA.

Thanks in advance,

JP
 
E

egerds

I reuse sub-forms and pass Application.CurrentObjectName to my
functions to indicate which main form the sub-form is nested in.
 
D

dymondjack

There's a programmable way to track a procedure call stack. Coupled with
egerds idea, it would be possible to track what object calls what procedure,
and which nested procedures are current.

It invloves the use of a public array, and each time a procedure is called,
its name gets added as an element to the array. Every time a procedure is
done, it removes the element. This is very handy for
error-handling/debugging, being able to see the call stack. I would think it
wouldn't be all that difficult to add the object name as the first element.

FMS is where I got it from...

http://www.fmsinc.com/tpapers/vbacode/Debug.asp#AdvancesErrorHandling

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain
 

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