Disabling Text Fields using a Checkbox?

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

I have a number of text fields (bound to a table of data) on my form.

I have added an unbound checkbox.

What I want to do is disable and grey-out if possible some of the text
fields if the checkbox is ticked.

How can I achieve this?

Thanks
 
Keith

In the AfterUpdate event of the checkbox, add code something like:

Me!txtFirstTextBox.Enabled = (Me!chkMyCheckBox = True)
Me!txtSecondTextBox.Enabled = (Me!chkMyCheckBox = True)
...

or ...=False), depending on how you want the checkbox to affect the others.
 
Greetings,

On this same subject, any thoughts on how I would make a text box grayed out
as in this post but as the default when the form opens unless a checkbox is
currently or becomes checked in the future?

Thanks,
Scott B
 
Scott

Controls have properties. One of them is .Enabled. If you set the Enabled
property of your control (textbox) to "No", it will be grayed out on open
and until set to "Yes".
 
Back
Top