VBA: Disabling a control

J

Joan

How does one disable a button right after it has been clicked? I tried
setting the button's Enabled property to false on it's click event but I got
a message that this was not allowed when the control has the focus.

Joan
 
R

Ron Weiner

Move the focus elseware then disable.

SomeOtherControl.SetFocus
cmdbutton.enabled = false

Ron W
 
S

Sandra Daigle

Exactly - I often put a .001x.001 textbox on my forms and set focus to it.
It's too tiny to be seen and it doesn't seem as confusing as having the
cursor bounce off to some arbitray field/control.
 

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