How do I disable a command button after it is clicked?

irunergoiam

Registered User.
Local time
Yesterday, 18:57
Joined
May 30, 2009
Messages
76
I've got a command button that I would like to disable after it is clicked. Any ideas how I can do this and where I should put the code? I'm thinking it would go in the On Click event.

Thanks much for any feedback from the forum!
 
You could add the following to the end of buttons On Click event;
Code:
Me.Enabled = False
Me.Locked = True
Of course you will have to reveres both those settings at some stage when you wish to re-enable the button.
 
If you try to disable or lock a control that has the focus you will get an error message.

Before using either of the codes provided above by Big John Booty, be sure you set focus to another object, like another control.

Me.NameOfOtherObject.SetFocus
 
If you try to disable or lock a control that has the focus you will get an error message.

Before using either of the codes provided above by Big John Booty, be sure you set focus to another object, like another control.

Me.NameOfOtherObject.SetFocus
Oh yes I forgot to mention that, thanks Mr. B :)
 
No problem. I have been bitten by that one way to many times.
 
Thanks to you both. Setting the focus is the piece that I was missing.

Cheers...
 

Users who are viewing this thread

Back
Top Bottom