comand button enable/disable

ariel81

Registered User.
Local time
Today, 06:15
Joined
Dec 31, 2006
Messages
75
hi, i have a command button which is initially disabled. whenever i key in any data into a text field, the command button will be enabled.

now my problem is how can i disable the command button after clicking it once?

Code:
Private Sub CommandButton_Click
  

  CommandButton.Enabled = False
End Sub

i wrote the abv code but it gives the error: "You can't disable a control while it has the focus." during run time.
 
Hey Ariel,

Add one more step before you change the command button. You need to set the focus to another control first then change the enabled property of the command button. Something like this:

Me.NameOfAnotherControl.SetFocus
Me.CommandButton.Enabled = False

HTH,
Shane
 

Users who are viewing this thread

Back
Top Bottom