Does anyone out there know how to do a stack trace in access-vba. I'm trying to do something like:
Public Sub a()
Call c
End Sub
Public Sub b()
Call c
End Sub
Public Sub c()
Debug.Print "Which sub has called me ?"
End Sub
What I want to do in Sub c
is to show if that has been called by Sub a
or Sub b
without passing any arguments. In c I would simply show the stack but I have no idea if this is even possible in VBA - any thoughts ?
To call a Sub procedure from another procedure, type the name of the procedure and include values for any required arguments. The Call statement is not required, but if you use it, you must enclose any arguments in parentheses. Use a Sub procedure to organize other procedures so they are easier to understand and debug.
You can run a Sub procedure in the VBA Editor by pressing F5 or from the menu bar Run. An end user can start a sub from a button on a worksheet or from the ribbon.
You can call a Sub from another Sub or User-Defined Function in VBA by using the term “Call” with the name of the Sub, or simply putting the name of the Sub. If the Sub to be called contains an argument, you have to call the Sub with any value of that argument.
You can use Mztools Addins which has an option to view the procedure caller. Download Mztools
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With