One List Box Dependent On Another List Box

  • Thread starter Thread starter kennedy
  • Start date Start date
K

kennedy

Guest
I am trying to create a database in which one list box is dependent on another list box. The database is about sports statistics, so the first list box will include all sports (e.g., football, basketball, baseball, etc.). The second list box will include all teams in each sport.

I would like to set up the database, so that when you enter/select football in the first list box, only teams that play football will come up in the second list box.

If someone has the time, could you explain the easiest way to do this. If at all possible, I would like to keep the two boxes separate.

Thanks.
 
Just change the second list box's rowrouce depening on the row selected in the first list box.
 
Thanks. I have found the area for the rowsource, but I'm just not sure what to type in.
 
Use VBA to find the selected row in the first list box, the ID column of which (probably hidden) will then be used via VBA as a filter on the rowsource of the second list box.
 
I wanted to do a similar thing so I created a Combo box that i could select, in your case the sport, from. Use the row resource and do a list of the intended sports. Now create a list box and filter using the data in the combo box from your table (which should contain 2 fields ie Sport, Team. When you create the list box you can tell it what you want it to display ie Teams. Now simply go to edit mode and right click on your list box. Go to Row source and click on the (...) that is behind the box on the right hand side. This should bring up the SQL page. Now in the Criteria section of Teams type:

[Forms]![MyForm]![MyCombobox]

where My form is the name of your Form and
MyComboBox is the name of your Combo box

Hope you understand what i have done here, I have been learning for 2 days now. Reading is always good.
 

Users who are viewing this thread

Back
Top Bottom