Nick,
First be sure that the *names* you're using is the name of the form
*control* (in the control's Name property on the Other tab), NOT the name of
the field to which it is bound. Most programmers use a control naming
convention of a 3-character prefix specific to the type of control followed
by the name of field to which it's bound, e.g., chkCustody, cboEvent.
Assuming that you follow this naming convention, and that the value of
cboEvent is the string "Case Plan Com", the code would be:
If Me![chkCustody] = True Then
If Me![cboEvent] = "Case Plan Com"
Cancel = True
MsgBox "Case Plan Completed is not available for Custody cases.
Select another value."
Me![cboEvent].SetFocus
End If
End If
If this doesn't work, I would guess that although your combo box *displays*
"Case Plan Com", its value is some integer value. This would be the case if
you're getting your list from a table with a numeric primary key and you've
set the ColumnWidths property of the combo box to 0"; x" (where x is some
number). If this is your situation, you will need to change "Case Plan Com"
to the integer value corresponding to this string, without quotes.
If you still can't get it to work, please post the following properties:
chkCustody
Name
ControlSource
cboEvent
Name
RowSource
BoundColumn
ColumnWidths
ControlSource
Hang in there; we'll get it!
Sprinks
Nick said:
I'm having some Syntax problems, probably because I'm a beginner. The check
box = "Custody". The Combo Box = "Event" and Case Plan Completed on the
table is "Case Plan Com. I can't get it all together? Any suggestions?
Thanks.
Sprinks said:
Nick,
Use the BeforeUpdate event of the combo box to cancel the update. Note that
the ComboBox's *value* could be different from what is displayed depending on
the setting of the Bound Column and DisplayWidths properties.
If Me![YourCheckBox] = True Then
If Me![YourComboBox] = YourValueCorrespondingtoCasePlanCompleted
Cancel = True
MsgBox "Case Plan Completed is not available for Custody cases.
Select another value."
Me![YourComboBox].SetFocus
End If
End If
Sprinks
Nick said:
I'm trying to prevent/minimize incorrect data entry on a form. If "Custody"
is checked then "Event" Combo Box will not except Case Plan Completed from
(Value List). I hope that provides enought info. for help. Thanks.