J
James
I am trying to get a subform to assign the value of 2 combo boxes for each
record using the ListCount of the first cbo (the one that all values will be
used. In the second combo box the same thing, but I don't want any of the
same values used more than twice (If ParentRecordID = 1 then sfrmComboboxID's
can only be used once with the same ParentRecordID.)
The first combo box determines what the second box will display in the list,
so the number of items the second combo box will be different for each
record.
How do I fix me code to accomplish the above task? Is there a way to
compare the actual values of all record with the same ParentID so that none
are used twice?
The code is below.
---------start code--------
With Me.sfrmPositionAssignment.Form
For i = 0 To .cboPositionID.ListCount - 1
If .cboPositionID.ListCount = 0 Then
MsgBox "There are no Positions available. Go to 'Program Setup'
on the main menu."
Else
.cboPositionID.Value = (i)
End If
Do While .cboEmployeeID.Value <> 1
If .cboPositionID.ListCount = 0 Then
MsgBox "There are no Positions available. Go to 'Program
Setup' on the main menu."
Else
.cboEmployeeID.Value = (i)
End If
Exit Do
Loop
Next i
End With
----------end code---------
record using the ListCount of the first cbo (the one that all values will be
used. In the second combo box the same thing, but I don't want any of the
same values used more than twice (If ParentRecordID = 1 then sfrmComboboxID's
can only be used once with the same ParentRecordID.)
The first combo box determines what the second box will display in the list,
so the number of items the second combo box will be different for each
record.
How do I fix me code to accomplish the above task? Is there a way to
compare the actual values of all record with the same ParentID so that none
are used twice?
The code is below.
---------start code--------
With Me.sfrmPositionAssignment.Form
For i = 0 To .cboPositionID.ListCount - 1
If .cboPositionID.ListCount = 0 Then
MsgBox "There are no Positions available. Go to 'Program Setup'
on the main menu."
Else
.cboPositionID.Value = (i)
End If
Do While .cboEmployeeID.Value <> 1
If .cboPositionID.ListCount = 0 Then
MsgBox "There are no Positions available. Go to 'Program
Setup' on the main menu."
Else
.cboEmployeeID.Value = (i)
End If
Exit Do
Loop
Next i
End With
----------end code---------