Yes/No

J

Jody

I have a form with about 60 yes/no check boxes on it. I need to have
different yes/no boxes related to others. For instance if one box is checked
then another box cannot be checked, or if this box is not checked then this
other box cannot be checked. I need this to have some type of message come up
telling the user why they cannot check this particular box.

I also have a couple of boxes that are linked to other types of fields than
yes/no.

At the present time everything is on one form from one table, I am thinking
of changing this since there is alot of information.

Any help anyone can give would be grately appreciated.
 
K

Klatuu

The easiest way to handle this is to put code in the Change event of your
check box. In this example, if cboBox1 is checked, then cboBox2 must be
unchecked:

If Me.cboBox1 = True Then
Me.cboBox2 = False 'Unchecks box 2
Me.cboBox2.Locked = True 'The user cannot change the value in Box 2
Else
Me.cboBox2.Locked = False 'In case it it locked, unlock it
End If

Also, in the current event of the form, you should be sure to unlock any
controls you locked in the previous record, unless they should remain locked
depending on the value in the other box. Using the same rules as above:

Me.cboBox2.Locked = Me.cboBox1

The above line of code will lock Box 2 if Box1 is checked, and unlock it if
it is not.

A warning message will not be necessary because they can't change the value
of a locked control.
 
Top