gray out checkboxes

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

Guest

I have several checkboxes on a Form. The first checkbox is a general yes/no
choice. If the answer is "no" on this checkbox, I would like all the other
checkboxes to be grayed-out. If the answer is "yes", then the other detailed
checkboxes would be black and allow for further yes/no responses.

I hope this is clear. Thanks for your help.
 
I have several checkboxes on a Form. The first checkbox is a general yes/no
choice. If the answer is "no" on this checkbox, I would like all the other
checkboxes to be grayed-out. If the answer is "yes", then the other detailed
checkboxes would be black and allow for further yes/no responses.

I hope this is clear. Thanks for your help.

First, set the Enabled property of all the check boxes (except the
general one) to No.

Then code the AfterUpdate event of the first check box:

Me![CheckBox2].enabled = Me![CheckBox1]
Me![CheckBox3].enabled = Me![CheckBox1]
Me![CheckBox4].enabled = Me![CheckBox1]

Place the same code in the Form's Current event.
 
The checkbox fields now work to a point: When I toggle the "master yes/no"
checkbox the others will go gray/black as they should.

However, as I scroll through records, this conditional formatting is not
remembered. That is, I often come to a record where the master yes/no is
"no" but the other boxes are black, or master yes/no is "yes" but the others
are grayed out. It does not remember and automatically interpret the master
yes/no unless it is updated.

Is there a way for the format to be attached to another event that will keep
it each time I go to a new record AND update a current record?

Thanks again!

fredg said:
I have several checkboxes on a Form. The first checkbox is a general yes/no
choice. If the answer is "no" on this checkbox, I would like all the other
checkboxes to be grayed-out. If the answer is "yes", then the other detailed
checkboxes would be black and allow for further yes/no responses.

I hope this is clear. Thanks for your help.

First, set the Enabled property of all the check boxes (except the
general one) to No.

Then code the AfterUpdate event of the first check box:

Me![CheckBox2].enabled = Me![CheckBox1]
Me![CheckBox3].enabled = Me![CheckBox1]
Me![CheckBox4].enabled = Me![CheckBox1]

Place the same code in the Form's Current event.
 
It sounds like you skipped Fred's second step about the
Current event.
--
Marsh
MVP [MS Access]


Ken said:
The checkbox fields now work to a point: When I toggle the "master yes/no"
checkbox the others will go gray/black as they should.

However, as I scroll through records, this conditional formatting is not
remembered. That is, I often come to a record where the master yes/no is
"no" but the other boxes are black, or master yes/no is "yes" but the others
are grayed out. It does not remember and automatically interpret the master
yes/no unless it is updated.

Is there a way for the format to be attached to another event that will keep
it each time I go to a new record AND update a current record?

fredg said:
First, set the Enabled property of all the check boxes (except the
general one) to No.

Then code the AfterUpdate event of the first check box:

Me![CheckBox2].enabled = Me![CheckBox1]
Me![CheckBox3].enabled = Me![CheckBox1]
Me![CheckBox4].enabled = Me![CheckBox1]

Place the same code in the Form's Current event.
 
Yep, I sure did. Sorry about that.

The code works great now. Thank you both, Fred & Marshall.

Marshall Barton said:
It sounds like you skipped Fred's second step about the
Current event.
--
Marsh
MVP [MS Access]


Ken said:
The checkbox fields now work to a point: When I toggle the "master yes/no"
checkbox the others will go gray/black as they should.

However, as I scroll through records, this conditional formatting is not
remembered. That is, I often come to a record where the master yes/no is
"no" but the other boxes are black, or master yes/no is "yes" but the others
are grayed out. It does not remember and automatically interpret the master
yes/no unless it is updated.

Is there a way for the format to be attached to another event that will keep
it each time I go to a new record AND update a current record?

On Fri, 23 Sep 2005 14:50:16 -0700, Ken Cobler wrote:
I have several checkboxes on a Form. The first checkbox is a general yes/no
choice. If the answer is "no" on this checkbox, I would like all the other
checkboxes to be grayed-out. If the answer is "yes", then the other detailed
checkboxes would be black and allow for further yes/no responses.
fredg said:
First, set the Enabled property of all the check boxes (except the
general one) to No.

Then code the AfterUpdate event of the first check box:

Me![CheckBox2].enabled = Me![CheckBox1]
Me![CheckBox3].enabled = Me![CheckBox1]
Me![CheckBox4].enabled = Me![CheckBox1]

Place the same code in the Form's Current event.
 
Back
Top