ComboBox or ListBox as part of a form

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

Guest

I am wanting to list players as part of a chess matches based on the team
they are playing for, and to just use the player's ID (rather than write all
the player's info).

I am guessing that I want a Combo or List Box so that when:

Team: Wayne High School

then Player ID: asks for a Wayne player and I have a listing of the
Wayne players to select from.
 
I am wanting to list players as part of a chess matches based on the team
they are playing for, and to just use the player's ID (rather than write all
the player's info).

I am guessing that I want a Combo or List Box so that when:

Team: Wayne High School

then Player ID: asks for a Wayne player and I have a listing of the
Wayne players to select from.

You can base the player Combo Box on a Query which references the Team
combo box. Let's say you have a table of Teams, and that the Players
table has a foreign key to the Team table (TeamID or team name?
doesn't much matter).

Create a Query on the Players table with a criterion

=Forms![YourFormName]![cboTeam]

referencing the combo box (which I called cboTeam) on your form, as a
criterion on the team field. This query can then be used as the
RowSource of the player combo box.

One additional step is needed: in the AfterUpdate event of cboTeam put
VBA code like

Private Sub cboTeam_AfterUpdate()
Me!cboPlayer.Requery
End Sub

to "wake up" the player combo to the fact that its row source has
changed.

Oh... and e2-e4. (Unlike my friend's chessplaying program many years
ago which opened E1 to E-1 checkmate).

John W. Vinson[MVP]
John W. Vinson[MVP]
 

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

Back
Top