all the values are stored In the same table.
Many ways to do this.
My approach would be to create a global dictionary containing key/value pairs where the value is a delimited sequence of data that should be inserted into the other combobox.
In other words, something like
-
Public d As New Dictionary 'Scope to global (public) so we can use the dictionary elsewhere in code.
-
-
'**set a reference to Microsoft Scripting Runtime or scrrun.dll
-
' otherwise, declare d as variant and set it to CreateObject("Scripting.Dictionary")
-
-
d.add "Combo1KeyText", "Value1^Value2^Value3^Value4"
-
d.add "Combo2KeyText", "Value1^Value2"
-
d.add "Combo3KeyText", "Value1^Value2^Value3"
-
Then, capture the comboboxes changed event and load the Values list into the other combobox.
-
Private Sub Combo1_Change()
-
Dim sValues As String
-
Dim varValues
-
Dim i as Integer
-
If d.Exists(Combo1.Text) Then 'd is our global dictionary object
-
Combo2.Clear
-
sValues = d(Combo1.Text)
-
varValues = Split(sValues, "^")
-
For i = 0 to ubound(varValues)
-
Combo2.AddItem varValues(i)
-
Next i
-
End If
-
End Sub
-