Enabling a Command button with a check box.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like a check box to control the enabling/disabling of a command button. HOw would I do this, I've tried everything I know

I have the command button working the way I want and I have the check box already in the form.
 
In after update event of checkbox, put Me.YourCommandbuttonName.Enabled =
Not (Me.Check)
Damon

Broadw425 said:
I would like a check box to control the enabling/disabling of a command
button. HOw would I do this, I've tried everything I know.
I have the command button working the way I want and I have the check box
already in the form.
 
Its telling me that the macro ME. does not exist

Maybe I'm doing something wrong, I am new at this stuff.
 
Its telling me that the macro ME. does not exist.

Maybe I'm doing something wrong, I am new at this stuff.

Please include the relevant portion of any previous post, so that
other readers can have some idea of what this post is all about.

You evidently wrote the code the other replier gave you on the
AfterUpdate event line, not in the AfterUpdate code window.

Click on the Check Box field.
Display the property sheet.
On the AfterUpdate event line type
[Event Procedure]
Then click on the little button with 3 dots that will appear on that
line.
When the Code window opens, type

Me![YourCommandbuttonName].Enabled = Me![CheckBoxName] = True
'(or False, I don't rememeber which way you wanted to go with this.)

between the 2 already existing lines.
Exit the code window

Place the same code in the Form's Current event.
 
I would like a check box to control the enabling/disabling of a command button. HOw would I do this, I've tried everything I know.

I have the command button working the way I want and I have the check box already in the form.


Assuming the following...

Checkbox name = chkBox
Button name = cmdButton

The following code in the chkBox click event...

Private Sub chkBoxl_Click()
Me!cmdButton.enabled = Me!chkBox
End Sub

Cheers!
 
Private Sub chkBoxl_Click()
'Test value of checkbox
if me.chkbox1.value= -1 then
me.cmdbutton.enabled=True
else
me.cmdbutton.enabled=false
end if
'Set enabled property of button to no by default.

I also add the if statement to the on activate event

Hope this helps...Thanks
-----Original Message-----
enabling/disabling of a command button. HOw would I do
this, I've tried everything I know.have the check box already in the form.
 
Back
Top