3 choices

Niniel

Registered User.
Local time
Yesterday, 23:41
Joined
Sep 28, 2006
Messages
191
Hello,

I have an option group with check boxes on my form that updates a yes/no field in a table, so the choices the user used to have were check "something A" or "something B". Now I have to add a third choice of "nothing" to this.
Is there a way to achieve this with my current setup, or do I need to add a field to my table so that I can have the choices of "something" or "nothing", and then of "something A" or "something B" if the user choses "something"?

Thank you.
 
I'm not exactly sure what you mean by that, sorry.

Right now I am using an if statment to un/hide the second option group. What I am wondering though is if there was a way to do all this without using 2 options groups.
 
Each option group can only return 1 result which is normally stored in the table. You should only have 1 field in you table to store these results.

If you want to add another option to the group, then just drag it (say another check box) from the tool box to you option group. When you do this just check that the option value is the next highest (e.g.) yes = 1 no = 2 new one = 3)

If you have a look at the example I have posted you will see that I have a tables with the Text values of the option values, this make is easy to produce queries and also to use the data in a report that show “yes” “no” etc as text instead of numbers.

If you use my method then make sure that when you add an item to an option group that you also add it to the table.


Hope this helps.
 
Last edited:
I thnik you can have a triple state check box ie true false or not set. I haven't used them, and I am not sure how visually you would distinguish between false and not set, but I guess yuo would see this.
 
Thank you, John, that was a very nice example file.

Unfortunately, I am using yes/no [boolean] fields, and I am reluctant to change my entire database at this point. The reason why I chose those is that I really need checkboxes for data entry and it was easier for me to go that route.
 
Last edited:
Option groups usually show radio buttons rather than checkboxes so your statment that you have an option group is confusing. Do you have one field defined or two? If you are truely using an option group, you would be storing a numeric value rather than true or false which is what checkboxes store.
 
You stated in your first post;
I have an option group
I don't think you do, I think you have yes/no fields defined in the table.
This is why my sample is no good to you.
 
did you look at the triple state property for check boxes - I'm sure this is what you need.
 
Pat, John,

Thank you for your replies.
But believe it or not, I am using an option group on my form. And as I said in my initial post, yes, I do have a yes/no field in my table. It is no problem to use check boxes in an option group, just as it is no problem to have them put out either "-1" and "0", or "true" and "false"; just take a fresh look at the wizard. :)
I am using the option group because at the time it was the easiest way for me to make sure the user can only select one thing or another.

Gemma, I have not yet looked very seriously into the triple state property; I guess I should give it a try.
 
Ok, Gemma, I'm not sure a triple state checkbox setup will work for me in this case. Why? Because I read in my Access book that once a value has been selected, the field can never go back to Null.
What I am trying to do here is to show publishing options - publish method 1, publish method 2, or don't publish at all. I was thinking that method 1 should be "yes", method 2 "no", and the no publishing option should be "null".
But although one can reasonably assume that once people decide to publish, they won't later reverse course, one cannot be certain, so if they do change their minds, a triple state checkbox would not be able to capture that information anymore.
Or are there ways around it?
 
Last edited:
you probably need a value list combo box then for each option, where you can have

1 = yes
2 = no
0 = not decided

or indeed any other values you want

just means storing numbers rather than yes/nos in your dbs, so it might mean a few design changes - depends how far you've got.
 
Throwing out the yes/no fields is something I'd rather not do at this point, so I think I'll just stick with my 2 fields. Or maybe the people who are going to use this db can tell me how un/likely it is for people to change their minds, and maybe I can go the triple-state route after all.

Thank you.
 
A yes/no field should not be bound to an option group. An option group returns an integer. It does not return true and false. Your situation happens to work but it is not good practice. Now that you have discovered a third state, it would be best to change the field definition before moving on.
 
I've been messing around with the same kind of thing this morning. If you change the data type in your table field to a number rather than a boolean "Yes/No" you might not be causing such a problem.
a) When you change the data type the current data stored will be converted to numbers from boolean values "Yes/No" but they are represented the same way i.e. Yes = "-1" and No = "0" as booleans but as numbers they are converted to "-1" and "0" so you won't lose everything stored as long as your code is changed to spot a number value rather than a boolean. "-1" isn't "Yes" or "True" anymore it is -1 (a number) and can only be spotted by treating it as a number value.

On your form add a checkbox and set it's triple state value to True. Then Set it's control source to the relevant table field. If you cycle through the checkbox states you'll be moving through "-1", "0", "Null". Probably best to set the table default valuie for the field to Null then each new record starts with a "null" (not selected) value.

You'll then find you can cycle through the checkbox between -1/0/Null as many times as you like storing a "-1", "0", "Null" value in the table field.

!! The thing to watch for is that your code will need to take account of the fact that you have moved from boolean to number data and would need to be changed to look for values of -1, 0, null rather than "True/Yes", "False/No" !!

I don't know if this helps, or even if it's right, i've only posted before and not replied but i reckon it'll work for me, so i'm going to give it a bash!...Unless someone knows better?

Vince
 

Users who are viewing this thread

Back
Top Bottom