Re: Allow routine to finish when called multiple times

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



The advantage to do it this way is that it provides positive feedback to the
user. He/she soon learns not to even try to click the button continuously.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"SandyGrzesik" <SandyGrzesik@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A4110A42-37B5-4155-A388-4621AF533E3C@xxxxxxxxxxxxxxxx
I may have to do this, but I was hoping for a different solution.

Thanks for your input!

Sandy G.

"Arvin Meyer [MVP]" wrote:

I once had a user that pressed a bulk email button continuously and wound
up
spamming our customers to death. I set focus to a different control, then
disabled the button. You must do something similar (aircode):

Sub cmdWhatever_Click()
Me.SomeOtherControl.SetFocus
Me.cmdWhatever.Enabled = False
'Run your other code
'Tou may need a DoEvents here
Me.cmdWhatever.Enabled = True
End Sub

That should prevent any clicking on the button.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"SandyGrzesik" <SandyGrzesik@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0A2C8FA0-940D-4868-828B-1304EDFECC6D@xxxxxxxxxxxxxxxx
I have two forms. They can both be open at the same time. Form1 is the
driver form and has a "next" button. When pressed, it calls Routine1
which
reads the next set of data, populates the fields on Form1, then calls
Routine2 to populate the fields on Form2.

This works great until they start pressing the Next button really fast.
Routine2 doesn't finish processing each call and eventually an error is
generated, and the wrong data can be on Form2.

Is there any way to ensure that when calling Routine2, it is completed
before it is called again? Doesn't seem like this is a DoEvents issue,
but
any help would be greatly appreciated.






.


Quantcast