Determine Calling Function

C

CBKowitz

Is there a way, through code, to determine who or what called a specific
function? For instance you have Function A that calls Function B or you have
Macro C that call Function B. Is there some code that would reside in
Function B that could determine that it was called by Function A or Macro C?

Thanks.
 
D

Douglas J. Steele

Unfortunately, no such functionality exists in Access. You could always pass
an extra argument providing that information to function B.
 
K

Klatuu

Just add an argument to Function B that each caller passes. Each caller
should pass a value that would identify it.

Public Function B(lngWhoCalled, OtherStuff) As String

Select Case lngWhoCalled
Case 0
MsgBox("A Called")
Case 1
MsgBox("B Called")
Case 2
Msgbox("You Mom Called")
End Select
 
A

Alex Dybenko

Hi,
one more approach - is to make a stack, and in each proc start push there
proc name, and at the end - pop the name, so at any proc you could know the
whole calling chain.
I think you can find several samples of this in internet


--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 

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