Yes/No/Unkown Checkbox

  • Thread starter benton via AccessMonster.com
  • Start date
B

benton via AccessMonster.com

I'm trying to design a table and a form. There's a fieldname called Smoking
in my table.This smoking field name has a boleean data type.It asks if the
patient smokes and if yes the the checkbox will be ticked and no it will not
be ticked.There's patients whose smoking status is Unkown.So it has to be
YES/NO/UNKOWN.Now i don't know how to accomodate the " UNKOWN" in "SMOKING
FIELD"
 
K

Ken Snell [MVP]

Change the Boolean field in the table to Integer. Change its Default Value
to Null.

Then set the Triple State property of the checkbox (bound to the field) on
the form to Yes. Now the field can store -1 (True or Yes), 0 (False or No),
and Null (unknown) as its values. So, if you don't know, just leave the
checkbox alone on the form (don't click it at all); it'll stay in that
"greyed" look, meaning it's storing a Null value.

If you want the ability to change from a Yes to Unknown, then you'll need to
put a command button next to the checkbox that you'd click; this button
would run simple macro/code that sets the value of the checkbox to Null.

Or, you can forgo the entire checkbox/TripleState setup and use an option
group that is bound to the Integer field. Then you can select the correct
option from the radio buttons, and store a specific value (e.g., 1 for Yes,
2 for No, 3 for Unknown) in the field.
 
B

Baz

benton via AccessMonster.com said:
I'm trying to design a table and a form. There's a fieldname called Smoking
in my table.This smoking field name has a boleean data type.It asks if the
patient smokes and if yes the the checkbox will be ticked and no it will not
be ticked.There's patients whose smoking status is Unkown.So it has to be
YES/NO/UNKOWN.Now i don't know how to accomodate the " UNKOWN" in "SMOKING
FIELD"


Unfortunately your data isn't boolean because it has three possible values,
so you can't store it in a Yes/No (boolean) field.

If you change the field to integer, and set the check box's Triple State
property, then you will find that you can set it to true, false or null.
 
B

Baz

Ken Snell said:
Change the Boolean field in the table to Integer. Change its Default Value
to Null.

Then set the Triple State property of the checkbox (bound to the field) on
the form to Yes. Now the field can store -1 (True or Yes), 0 (False or No),
and Null (unknown) as its values. So, if you don't know, just leave the
checkbox alone on the form (don't click it at all); it'll stay in that
"greyed" look, meaning it's storing a Null value.

If you want the ability to change from a Yes to Unknown, then you'll need to
put a command button next to the checkbox that you'd click; this button
would run simple macro/code that sets the value of the checkbox to Null.

Or, you can forgo the entire checkbox/TripleState setup and use an option
group that is bound to the Integer field. Then you can select the correct
option from the radio buttons, and store a specific value (e.g., 1 for Yes,
2 for No, 3 for Unknown) in the field.

If you simply keep clicking a triple-state checkbox then it cycles through
all three states.
 
K

Ken Snell [MVP]

Baz said:
If you simply keep clicking a triple-state checkbox then it cycles through
all three states.
Thanks, Baz... I think you can tell that I don't use TripleState
controls.... < g >
 
B

Baz

Ken Snell said:
Thanks, Baz... I think you can tell that I don't use TripleState
controls.... < g >

Nor me. I've looked at 'em before, but I think the null state is too
obscure/unclear for users.
 

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