synchronize two combo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form and there are two combo box's. Each combo box is populated by
"Row source type=Value list" and "Row source=text;text1,text2". how do i
populate my second combo box based on the first combo box selection? (the
values in the combo box's are populated on the form level, the values are not
in tables, as i have seen examples of this on other tutorials)
 
Hello,

I have a form and there are two combo box's. Each combo box is populated by
"Row source type=Value list" and "Row source=text;text1,text2". how do i
populate my second combo box based on the first combo box selection? (the
values in the combo box's are populated on the form level, the values are not
in tables, as i have seen examples of this on other tutorials)

Leave the second combo box rowsource blank.
Code the Combo1 AfterUpdate event like this:

If Me!Combo1 = "XYZ" Then
Combo2.Rowsource = "this;that;somethingelse"
Elseif Me!Combo1 = "ABC" then
Me!Combo2.Rowsource = "Other;than"
Else
Me!Combo2.Rowsource = "different;things"
End If
 
Although I certainly prefer using a table or query as a row source to
increase its visibility, to set one to a value list, you will have to change
one or more of the following properties, depending on how they are set as a
default:

Private Sub Combo1_AfterUpdate()
Me!Combo2.RowSourceType = "Value List"
Me!Combo2.ColumnCount = 1
Me!Combo2.ColumnWidths = "1 in"
Me!Combo2.RowSource = "Value1;Value2;Value3;Value4"
End Sub

Hope that helps.
Sprinks
 
Back
Top