One list box to control the cource of another list box

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

Guest

I have been trying to have one list box set the row source of another list
box, without success in Access 2003.
Example: control "A" has a list of products-rowsource from a table.
Selecting a
procuct will change the rowsource of Control "B" to a different list in
another table.

It seems simple enough, but I can't find instructions on it. Should it be in
vb code and if so where should the code go or is it something that can be set
in properties?
Thanks,
Cliff
 
I have been trying to have one list box set the row source of another list
box, without success in Access 2003.
Example: control "A" has a list of products-rowsource from a table.
Selecting a
procuct will change the rowsource of Control "B" to a different list in
another table.

It seems simple enough, but I can't find instructions on it. Should it be in
vb code and if so where should the code go or is it something that can be set
in properties?
Thanks,
Cliff

The following refers to a combo box, but the List box would work the
same.

Leave the rowsource of the 2nd combo box blank.
Code the AfterUpdate event of the 1st combo box to fill the rowsource
of the 2nd.
Something like this:

Combo2.Rowsource = "Select Instructors.InstructorID,
Instructors.InstructorName from Instructors Where Instructors.ClassID
= " & Me!ComboName & ";"

Change the table and field names as needed.
The above assumes ClassID is a Number datatype and the combo box BOUND
column is Number datatype also.
 
Back
Top