Gray Out Form Fields

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

Guest

Hi all...

Is there a way of doing this:

On a form.. Person has a yes/no checkbox. Below the check box the fields
are locked so they cannot enter anything. If they put a check in the check
box I would like the other fields below it to become editable. Does this
make sense?? Is this even possible in access?

Thanks
R~
 
Hi,
sure...just add code to the after update event of the checkbox e.g.:

If Me.Checkbox = True Then
Me.YourControl01.Enabled = True
Me.YourControl02.Enabled = True
Me.YourControl03.Enabled = True
Else
Me.YourControl01.Enabled = False
Me.YourControl02.Enabled = False
Me.YourControl03.Enabled = False
End If

BTW...forms hold controls...fields are in tables.
HTH
Good luck
 
You're welcome.
You could also directly evaluate the boolean value with the enabled property
instead of using an if then else statement. You would toggle two boolean
values in that case e.g.:

Me.YourControl01.Enabled = Me.CheckboxControl
Me.YourControl02.Enabled = Me.CheckboxControl
....
You can do this on the on current event of the form!
Good luck
 
Hello again..

I haven't tried the second method.. yet.. The first one works fine
except.. I have to check the box first then uncheck it and then the boxes
will go gray. Is there any way to make it gray until you put a check in the
box?

Thanks
R~
 
Ok.. I tried the second method and it is doing the same thing. Is there
something I need to switch to tell it to be in the "no" position? That would
cause the grayed out fields to be grayed out right of the bat?

Thanks again
Rhett
 
And if so.. where does it go???

Thanks
R~

Rhett_Y said:
Ok.. I tried the second method and it is doing the same thing. Is there
something I need to switch to tell it to be in the "no" position? That would
cause the grayed out fields to be grayed out right of the bat?

Thanks again
Rhett
 
Hi all..

I figured it out.. I had to make the box/field disabled.... then used the
code above so now it is grayed out until you check the check box....

Freak...

Thanks for the code mucho appreciated!!!!!!

R~
 
Back
Top