Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Button after Use 1

Status
Not open for further replies.

mekohler

Technical User
May 4, 2007
64
CA
Hi, I have an update button on my form. I would like it so that it cannot be pressed more than once. So, as an event on click I put cmdupdate.enabled = False. However I get the error Run-time error '2164' You can't disable a control while it has focus. Is it possible to programmably shift the focus from the button and then disable it?
Thanks,
Michael Kohler
 
Pick the next logical control (like a text box or another button) in your flow and use SetFocus.

Code:
Me![SomeControlName].SetFocus
Me![CommandButtonName].Enabled = False

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
 
Thank you, that worked.
Michael Kohler
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top