Hi all, I wish to use vba to complete 2 combobox selections, rather than use a query. so far i have
Combo1 = AAA
BBB
Combo2 = CCC
DDD
EEE
FFF
So if i choose AAA in combo1 then combo2 gives me the chioce of CCC or DDD
and if i choose BBB in combo1 then combo2 gives me the choice of EEE and FFF
Heres my code, but i need it to remove the items i dont need in combo2.
How do i quickly fix that in the code below? thanks
***********************
Private Sub Form_Load()
cboBox1.AddItem "AAA"
cboBox1.AddItem "BBB"
Private Sub cboBox1_AfterUpdate()
If cboBox1.Value = "AAA" Then
cbobox2.AddItem "CCC"
cbobox2.AddItem " DDD"
ElseIf cboBox1.Value = "BBB" Then
cbobox2.AddItem "EEE"
cbobox2.AddItem "FFF"
End If
End Sub
Combo1 = AAA
BBB
Combo2 = CCC
DDD
EEE
FFF
So if i choose AAA in combo1 then combo2 gives me the chioce of CCC or DDD
and if i choose BBB in combo1 then combo2 gives me the choice of EEE and FFF
Heres my code, but i need it to remove the items i dont need in combo2.
How do i quickly fix that in the code below? thanks
***********************
Private Sub Form_Load()
cboBox1.AddItem "AAA"
cboBox1.AddItem "BBB"
Private Sub cboBox1_AfterUpdate()
If cboBox1.Value = "AAA" Then
cbobox2.AddItem "CCC"
cbobox2.AddItem " DDD"
ElseIf cboBox1.Value = "BBB" Then
cbobox2.AddItem "EEE"
cbobox2.AddItem "FFF"
End If
End Sub