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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top