is Clickyes running if not runit

  • Thread starter Thread starter Trev B
  • Start date Start date
T

Trev B

Hi,

Thanks in advance

I need to test if clickyes is running

sub isclickyesrunning()
'ok thats what we want carry on

else

start clickyes

endif

end sub
Once again thanks for your help
 
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
 
Hi Doug,

Have tried the method but it says false whether it is running or not!

Any more suggestions?

Thanks for your help it is very much appreciated.

Trev B
 
Back
Top