how do I gray out an checkbox

G

Guest

I was looking to gray out other check boxes when another check box is chosen
and found the mmessage below. My problem is I am haveing a real tough time
making this work!! I am new to writing code and adding controls to forms and
would greatly appreciate anyone who can further explain the to a brick like
me!! Thanks!

Myron


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

BruceM

Myron Mummey said:
I was looking to gray out other check boxes when another check box is
chosen
and found the mmessage below. My problem is I am haveing a real tough
time
making this work!! I am new to writing code and adding controls to forms
and
would greatly appreciate anyone who can further explain the to a brick
like
me!! Thanks!

Myron


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

pvdg42

Myron Mummey said:
I was looking to gray out other check boxes when another check box is
chosen
and found the mmessage below. My problem is I am haveing a real tough
time
making this work!! I am new to writing code and adding controls to forms
and
would greatly appreciate anyone who can further explain the to a brick
like
me!! Thanks!

Myron
You don't mention what language you're using, so this is a guess.
If you're using Visual Basic .NET, the correct syntax is:

Me.CheckBox1.Enabled = True/False (true to enable. false to disable (gray
out))

If you're not using VB.NET, please post back and tell us what language and
project type you are using.
 
D

Douglas J Steele

pvdg42 said:
You don't mention what language you're using, so this is a guess.
If you're using Visual Basic .NET, the correct syntax is:

Me.CheckBox1.Enabled = True/False (true to enable. false to disable (gray
out))

If you're not using VB.NET, please post back and tell us what language and
project type you are using.

Why would you think it's VB.Net in a newsgroup related to Access?

Fortunately, it's the same syntax in Access VBA.
 
P

pvdg42

Douglas J Steele said:
Why would you think it's VB.Net in a newsgroup related to Access?

Fortunately, it's the same syntax in Access VBA.
Because I had my idiot hat on when I posted and *thought* I was in a
different group, the .NET general group, to be exact.
Boy, is my face red!
 
G

Guest

Sorry I didn't get back right away, holidays!! I wasn't clear enough before.
Attempt #2: I have six check boxes on an acess form. If I check the first
one it will need to grayout the other five. The user can only have one
choice. I am using Access 2003 and will use whatever code it takes or event
procedure, whatever it takes, I just want gray boxes but nothing I try
works!!! Your code looks like it will work but where am I supposed to use it
and how? Is this an expression, or is it code or a condition in a Macro? I
am new to alot of this getting a crash course so tp speak! Thanks in advance
I appreciate any help!

Myron
 
D

Douglas J Steele

You're not using checkboxes the way they're intended to be used. Since your
users will presumably have been exposed to other applications, this can
cause problems.

Checkboxes are for multiple choices: if you have 6 checkboxes, you're
supposed to be able to choose 0 through 6 of them simultaneously.

For what you want, you should be using radio buttons in an option group.
 
G

Guest

Hmmm...good point I never reallt thought about it!! I was trying to give the
boss exactly what he envisions thinking a checkbox would do the trick!! I
will look into radio buttons first thing tomorrow and get back to you!!
Thanks!!

Myron
 

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

Top