Enable/Disable Part of a Form by a Check Box

aaronmib

Registered User.
Local time
Today, 09:10
Joined
Oct 13, 2011
Messages
14
On a Form I want a field to be disabled unless a check box is clicked. If the check box is unchecked I want it to fo back to be disabled.

Any Suggestions?
 
Try the following VBA code in the After Update event of the check box:

Code:
Me.NameOfYourControl.Enabled = Me.NameOfYourCheckbox

Just replace the "NameOf...." with the actual names of your controls.
 
If data exists in that one control that you want disabled if the checkbox is unchecked, do you want to clear that as well, or just leave it there?
 
I actually would like the data to be deleted if the box is unchecked. Can that be done?
 
I actually would like the data to be deleted if the box is unchecked. Can that be done?
Just supplement Mr B's code like this:
Code:
Me.NameOfYourControl.Enabled = Me.NameOfYourCheckbox
If Me.NameOfYourCheckbox = False Then
   If Len(Me.NameOfYourControl & vbNullString) > 0 Then
      Me.NameOfYourControl = Null
   End If
End If
 
Can I have the check box toggel two different controlfields so when the box is checked one field is enabled and the other disabled and if i uncheck the box they both switch?

This is waht I have but it does not toggle the field (control2) that is supposed to be enabled when the check box is unselected:
Me.Control1Name.Enabled = Me.CheckboxName
If Me.CheckBoxName.Enabled = True Then
Me.Control2Name.Enabled = False
Else
Me.Control2Name.Enabled = True
End If
 
Change to this instead:
Code:
Me.Control1Name.Enabled = Me.CheckboxName
Me.Control2Name.Enabled = [B][COLOR=red]Not[/COLOR][/B] Me.CheckboxName
 

Users who are viewing this thread

Back
Top Bottom