andyw27
asked on
Combo Box Puzzle
Hi,
I have a tricky problem to solve, which I’m a bit stuck on.
I have combo box which has numerical value within the first column. (cbo_1).
Under this I have 4 further combo boxes. (cbo_2 -> cbo_5)
The idea is that a user makes a choice from the cbo_1 control. For this example say its 10. The 10 have to be assigned to any of the other 4 combo controls.
So far I have set the change event of cbo_1 to populate each of the 4 controls which the value of cbo_1
I use this code:
For i = 1 To Forms!fdlgInspection.cbo_1 .Column(1)
sRS = sRS & "," & CStr(i)
Next i
Forms!fdlgInspection.cbo_2 .RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_3 .RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_4 .RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_5 .RowSource = Right(sRS, Len(sRS) - 1)
This is where I’m stuck. If for example the user selects 4 from any of the above controls then I would like the remaining 3 to have the values reset so the maximum they can choose is 6. Basically no matter what selection is made (in whichever order the grand total of the controls can never exceed the value held within Forms!fdlgInspection.cbo_1 .Column(1) .
Is this even achievable? Any suggestions much appreciated.
I have a tricky problem to solve, which I’m a bit stuck on.
I have combo box which has numerical value within the first column. (cbo_1).
Under this I have 4 further combo boxes. (cbo_2 -> cbo_5)
The idea is that a user makes a choice from the cbo_1 control. For this example say its 10. The 10 have to be assigned to any of the other 4 combo controls.
So far I have set the change event of cbo_1 to populate each of the 4 controls which the value of cbo_1
I use this code:
For i = 1 To Forms!fdlgInspection.cbo_1
sRS = sRS & "," & CStr(i)
Next i
Forms!fdlgInspection.cbo_2
Forms!fdlgInspection.cbo_3
Forms!fdlgInspection.cbo_4
Forms!fdlgInspection.cbo_5
This is where I’m stuck. If for example the user selects 4 from any of the above controls then I would like the remaining 3 to have the values reset so the maximum they can choose is 6. Basically no matter what selection is made (in whichever order the grand total of the controls can never exceed the value held within Forms!fdlgInspection.cbo_1
Is this even achievable? Any suggestions much appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.