Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box Control

Status
Not open for further replies.

tarena

IS-IT--Management
Nov 28, 2005
70
US
I need to put 3 check boxes on a form..."Yes", "No", "n/a". When one box is checked I need its value (yes, no or n/a) to show on the table that holds the data.

How can i accomplish this?

Thanks
Tarena
 
Rather than 3 checkboxes, I'd suggest a combobox with a value list as its Row Source Type and "Yes"; "No"; "N/A"; as its Row Source. Have it bound to a field in your table and the selection will be saved there.

Let them hate - so long as they fear... Lucius Accius
 
I think you have to bound the checkboxes to a controlsource. So make three extra fields in your table that is linked with the form, fi:
check1; yes/no (=datatype)
check2; yes/no etc..

Now for every checkbox on your form, you set its control source to the above fields in your table. If you check a checkbox, the value will be stored in the underlying table.




Pampers [afro]
Just back from holiday...
that may it explain it.
 
Is it adequate that if it is neither Yes or No then it is N/A by default? If so then:
1. Simply add a boolean field to the table
2. Add two unbound checkboxes to the form and a command button
3. In the onchange event of eachcheckbox set the value you desire in the table.
If the Yes box is selected add a True to the boolean field in the table
If the No box is selected add a False to the field
If N/A (neither box is selected) then the field will remain empty

Since it will be logically impossible to be both Yes and No then add an Option Group control which will toggle the boxes allowing only one to be 'On'. When creating the option group select 'no Default' which will produce the N/A condition (both checkboxes will be greyed out but selectable)

Don't forget to add a Reset (or you can call it an 'N/A') button. Users love to see check marks appear and disappear repeatedly, many, many times. You are interested in the final state of the check boxes.
A Reset button with 'Me.Frame0.Value = Null' in the click event will restore the condition to N/A again.

Does this help?

Lamar
 
Hi!

Alternatively, you can put them in a frame control and store the frame value. Then one and only can be checked.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Adding to Lamarw's comment above based on SuicidEd reminder:
Triple state must be set to 'Yes' or 'True'

Lamar
 
Incidentally, Jebry, wouldn't you be limited to saving either Yes or No but not N/A?

Lamar
 
Sorry, you don't need 3 bound checkboxes, but one bound bolean field as lamarw suggests. Or maybe beter, an option control/frame control

Pampers [afro]
Just back from holiday...
that may it explain it.
 
Hi Lamar!

When you put a check box in a frame control then it is given a frame value: 1, 2, 3 etc. Then the frame control's value is based on which check box is checked. You can bind the frame to the field and Access will store the value based on which box is checked. The values are given to the check boxes automatically when they are placed in the frame but you can change them to whatever values you like.

I should make one change, I think you need to use radio buttons instead of check boxes, but I am not sure, the check boxes may work that same way as the radio buttons.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top