Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox list is changed by selction of other conbobox

Status
Not open for further replies.

Papyruss

Technical User
Jan 9, 2002
1
CA
in a from I whant to change to list seen in the COMBOBOX #2 in relation to what as been choosen in Combobox #1

ex:

COMBOBOX 1 = SELECTION1
Combobox 2 = 1
2
3

if Combobox 1 = SELECTIONA
combobox 2 = a
b
c

and if combobox 1= anything else
comboxbox 2= 1
a
2
b
...


 
I've done this with two ListBox controls. You would need to find a combobox control that has a scroll event:

Sub List1_Scroll()
List2.TopIndex = List1.TopIndex
End Sub

Otherwise you will need to subclass the ComboBox control to capture the Scroll event. Check out for more information about subclassing.

-Adam-
 
Woops, I think I got a little ahead of myself there...

I think what you are asking is this:

Sub ComboBox1_Click()

ComboBox2.Clear

Select Case ComboBox1.Text
Case "Test1"
ComboBox2.AddItem "Test1 - Test1"
ComboBox2.AddItem "Test1 - Test2"
ComboBox2.AddItem "Test1 - Test3"
Case "Test2"
ComboBox2.AddItem "Test2 - Test1"
ComboBox2.AddItem "Test2 - Test2"
ComboBox2.AddItem "Test2 - Test3"
Case Else
ComboBox2.AddItem "Test1"
ComboBox2.AddItem "Test2"
ComboBox2.AddItem "Test3"
End Select

End Sub
----------------------------------------------

When the user clicks on an item in ComboBox 1, the ComboBox2 will be filled with the three corresponding items.

Hope I've answered your question.

-Adam-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top