I have a form with 30 check boxes on it. I plan on using a table with a 4 bit integer field to hold the data values of the check boxes using the bitor() to set the bits.
Example
checkbox1 checked
checkbox2 not checked
.
.
checkbox30 checked
I would then set bit 30 bit 2 and bit 1 in the integer field
Each time a record is displayed on the form I would read all the bits and set the value of the checkbox with
thisform.checkbox1.value=1 (or 0 if the bit is zero)
Question:
Can I set the checkbox controlsource with an expression such as: bitand(table.field,1) to test bit 1 and if it is set the check box .value automatically is set to 1 and the checkbox shows is checked?
My Answer: I don't think so as the user clicking the checkbox would have to set or clear the bit in the table.
I know I can set the controlsource to a Logical TYPE field.
Would it be best to set up the table with 30 logical fields and set the control source for each checkbox to that field?
I could then read all 30 fields and still set an integer field with the proper bits so I can index that field for my search. I think this is the best way with the exception that it takes 30 fields in the datatable.
Example
checkbox1 checked
checkbox2 not checked
.
.
checkbox30 checked
I would then set bit 30 bit 2 and bit 1 in the integer field
Each time a record is displayed on the form I would read all the bits and set the value of the checkbox with
thisform.checkbox1.value=1 (or 0 if the bit is zero)
Question:
Can I set the checkbox controlsource with an expression such as: bitand(table.field,1) to test bit 1 and if it is set the check box .value automatically is set to 1 and the checkbox shows is checked?
My Answer: I don't think so as the user clicking the checkbox would have to set or clear the bit in the table.
I know I can set the controlsource to a Logical TYPE field.
Would it be best to set up the table with 30 logical fields and set the control source for each checkbox to that field?
I could then read all 30 fields and still set an integer field with the proper bits so I can index that field for my search. I think this is the best way with the exception that it takes 30 fields in the datatable.