I'm working on an application that traces execution paths in MS Access VBA. However, I've run into a problem. It seems that you can dynamically assign handlers to control OnClick and and other such events in VBA, but I don't see a way to read events from those controls. For example:
With Forms("Order Entry").Controls("OK")
If .OnClick = "" Then
.OnClick = "fnProcessOrder"
End If
End With
This dynamically assigns the function "fnProcessOrder" to the "OK" button. However, if you try to get the value of that button, you get this:
With Forms("Order Entry").Controls("OK")
Debug.Print "My Handler -->" + .OnClick
EndWith
Results in:
--> [Event Procedure]
And no further detail. This does seem to be the behavior stated by Microsoft in here: https://msdn.microsoft.com/en-us/vba/access-vba/articles/commandbutton-onclick-property-access
But I'm wondering if there is anyway to go further than that.
I would have thought that that information would be in the MSysObjects and MSysQueries tables, but I don't see it there. I've tried extracting my test database using the Database Documenter, and I get that value from the generated documentation as well.
Is there a way to find the VBA function that was assigned to the control?