Greying out fields

  • Thread starter Thread starter Sel
  • Start date Start date
S

Sel

Can Access grey out fields on a form depending on whether or not a tick box
is ticked? And if it can how do I do it?!
 
In the AfterUpdate event of the checkbox, put code like:

Private Sub Check0_AfterUpdate()

Me.Text1.Enabled = Not Me.Check0

End Sub

That will gray out (disable) the field when the check box is checked, and
enable it when the check box is unchecked.
 
Thankyou, I've got it to work for one text box. Is it possible to disable
multiple fields (text boxes and drop-downs) by checking one check box?
 
Sure. And, in fact, you can do different things for different controls. For
instance, if you want a check in Check0 to disable Text1 and Text2, and
enable Text 3 (or no check in Check0 to enable Text1 and Text2 and disable
Text3), you'd use

Private Sub Check0_AfterUpdate()

Me.Text1.Enabled = Not Me.Check0
Me.Text2.Enabled = Not Me.Check0
Me.Text3.Enabled = Me.Check0

End Sub
 
Thanks, I tried that and the first time instead of disabling both Text 1 and
Text 2 it disabled Text 1 and cleared the information from Text 2! I've now
retried and now I can't get it to disable anything at all! Even when I
recreate a brand new form and try it on that it still won't work!

Is there some sort of option I may have pressed that has stopped this from
working?
 
Aah, it's ok now! Someones just pointed out to me that I'd got them the wrong
way round. Thankyou very much for your help - it's much appreciated!

Sel
 
Back
Top