is Clickyes running if not runit

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
 
B

BruceM via AccessMonster.com

What are clickyes and isclickyesrunning? In general, what real-world thing
are you trying to accomplish?
 
V

vanderghast

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
 
T

Trev B

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
 

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