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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple check boxes and change their value!

Status
Not open for further replies.

CindiN

Instructor
Jan 30, 2001
98
US
I am working on a Form in which I would like to have an option group which holds 4 check boxes. I would like the user to be able to select more than one box, which would in turn update the table with option values 1-4 respectively. Each of the 4 check boxes can represent a different field in the table. The problem lies in changing the value from either -1=True and 0=False to numeric values 1 thru 4.

I can create an unbound option group, then insert the 4 fields as check boxes, but I can't change their value ....OR... I can create an unbound option group, then copy the 4 check boxes from outside the group and paste then in the group, this allows me to change the option value of each to numbers 1-4 but I can't check multiple boxes at the same time.

Would rather do this without SQL or VBA if possible. I am open to other suggestions if you think there's an easier way.

Thanks in advance for your help.
 
Only one option in an option group can be selected at a time. If you have four option buttons in the group, each button can be assigned an OPTION VALUE (1,2,3 or 4). If the option group is BOUND to a field (that's one field), then the value of 1,2,3, or 4 is saved in the field, depending on which button is "on".

If the option group is unbound, you can code the AfterUpdate event of the option group to "do something" (like filter records based on the option selected)



 
You need to use checkboxes w/o the option group. Then buile the 2^N value depending on the specific check boxes.

Assume you have three checkbokes (chkA, ChkB & chkC)

Somewhere in the overall process, you need to translate the three to a single value which captures the "Set" which are ckecked:

If (chkA) then
[tab]MyVal = 1
End If

If (chkB) then
[tab]MyVal = MyVal + 2
End If

If (chkA) then
[tab]MyVal = MyVal + 4
End If


MyVal Now contains the unique value which determins which (if any) of hte check boxes is checked (True), so store it in your whatever table.

(chk a ~ 2^0, chkB ~ 2^1, and chkC ~ 2^2).


MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top