Question : Dynamic population of dropdown list based on contents of another control

HI all,
I have a sequence of 8 dropdown controls.  I a trying to figure out a way to populate one control based on the contents of the previous control.  These controls are used for recording  soil depth horizons in inches. Here is how it is supposed to work.
In the first control there will be values that are 0-1, 0-2, 0-3, 0-4, 0-5 ...0-16.
The second control needs to be populated with the number on the right of the first control followed by numbers larger than that value.  For example if 0-5 was selected in the first control, the second control should be populated with 5-6, 5-7, 5-8...5-16.

My pseudo code is something like this.
The each control will have an afterupdate event that will construct the list for the next control by extracting the value at the end of the selected item of the current control, then adding a hyphen and an incremented value greater than that value up to 16.

I think I can figure out all of the string manipulations, but I don't know how to take a list of text and set it as the value list of another control.  For example after I construct a string like ";5-6;5-7;5-8;5-9;5-10" how do I make it the value list of another control?

Thanks.

Answer : Dynamic population of dropdown list based on contents of another control

this is for the first and second combo boxes only.. do the similar coding for the rest of the combo boxes


Private Sub Combo1_AfterUpdate()
Dim strVal As String, j, x
j = Mid(Me.Combo1, InStr(Me.Combo1, "-") + 1)
For x = j + 1 To 16
    strVal = strVal + Chr(34) & j & "-" & x & Chr(34) & ";"
Next
Me.Combo2.RowSourceType = "value list"
Me.Combo2.RowSource = strVal
End Sub
Random Solutions  
 
programming4us programming4us