The easiest way would be to create a Boolean guard variable/property.
Private mIsClickRunning As Boolean
....
Private Sub ClickYes()
mIsClickRunning = true
...
mIsClickRunning = false
exit sub
End Sub
And test the value of mIsClickRunning. Note that you have to assign
mIsClickRunning to false for each exit point of the subroutine ClickYes.
Note that there is only one VBA thread of execution, so at most, other
procedures will be SUSPENDED rather than RUNNING. You can suspend code by
calling another procedure, by issuing DoEvents, entering in a modal form
(with timer event or otherwise), etc., but only ONE piece of code will be
effectively running (in progress).
If you run many MSAccess.exe and if you want to know if one of them is ever
running the said subroutine (example, because it would have to use a
resource in exclusivity), you have to relay on something like mutex, since
each MSAccess object will maintain its own variable mIsClickRunning, while a
mutex is owned by the operating system. But if you are only interested in on
MSAccess application running, a Boolean guard is more than enough.
Vanderghast, Access MVP