synchronize two combo

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)
 
F

fredg

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top