Combo Box to Display Data in Sub Form

S

smoothchris

I have a DB that keeps track of tournaments, teams, players and there golf
scores. I am attempting to create a form with a combo box that will allow
the user to select a tournament then the teams linked to that tournament to
be displayed in a sub form. I would like to make the sub form continuous so
that it appears more as a data grid.

The combo box, cmbTournaments, has a row source property set to select the
TournamentID and TournamentName from the tblTournaments table. The problem I
am having is getting a sub form on the main form to then display the proper
teams linked to the selected tournament. I have a table, tblTeams, that
contains a field TeamID and that lists all the teams. I also have a table,
tblTeamLink, that links the tblTournaments and the tblTeams together based on
the TeamID and the TournamentID. I have tried making the combo box bound and
adding items to the Link Child and Link Master fields of the sub form. But I
don’t think I put the correct information in these fields because it didn’t
work.

I am fairly new to Access and VBA. So any help would be greatly appreciated.
 
V

Vantastic

The best way to do this is to use a Query as your recordsource.

In that Query, for you TournamentID, refer its criteria to the combobox on
your form (the combobox should be unbound)

Use the beforeupdate event to re-query/reload the form/subform

Hope this helps
 
S

smoothchris

Thanks for the reply. But it is obvious that I am still not understanding
something. I seem to be having a very hard time with this for some reason.
Is the query for the record source on the form, subform or both? When you
say refer the query criteria to the combobox, what do you mean?

I apologize for the inane questions but I have not had such a hard time with
a concept in Access as this one. I am not sure what I am missing. Thanks
again for the help.
 

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