List records not in a set

M

MikeB

As you may know from other posts I've made here, I'm playing with
Access to build a small chess management system.

As part of a draw for a match, one of the options to consider is to
match players that have not played one another previously.

To do this, I would like to have a form with a Combo box that is
populated with all the players that the current player have not yet
played (and, as a bonus, not their own record as well).

I can construct a query to list all the players that a particular
player has played before. How can I now construct a query and how do I
put this in the combo box criteria, such that I get a list of all
players that are NOT in the aforementioned list?

Thanks.
 
A

Arvin Meyer [MVP]

You can use a sunquery, but that concept may be a bit difficult to explain.
Access can use an existing query in a join, just as it uses a table. So ...

Use the query that you already have as a starting point. Then create a new
query using the players table joined to your query. Drag the PlayerID from
the query, and whatever data you need from the player's table. Now in the
criteria box, and add "Is Null" w/o the quotes.. Add the PlayerID from the
Players table and the expression: [Forms]![YourFormName]![YourPlayerID
textbox] (substituting your names, of course)

Now save this second query, and use it as the rowsource for your combo. In
the form's Current event, add the line of code:

Me.ComboBoxName.Requery

to requery the combo with each new player.
 
B

Bob Quintal

@b1g2000pra.googlegroups.com
:
As you may know from other posts I've made here, I'm playing with
Access to build a small chess management system.

As part of a draw for a match, one of the options to consider is
to match players that have not played one another previously.

To do this, I would like to have a form with a Combo box that is
populated with all the players that the current player have not
yet played (and, as a bonus, not their own record as well).

I can construct a query to list all the players that a particular
player has played before. How can I now construct a query and how
do I put this in the combo box criteria, such that I get a list of
all players that are NOT in the aforementioned list?

Thanks.

The easiest technique is to use the query that contains those
opponents already met as a subquery against the list of all
opponents.

If your query of opponents previously played is called
qryPreviouslyMatched, and the ID of the team member you are matching
now is in the textbox MemberID, Something like

SELECT MemberName from Members
WHERE Members.MemberID
NOT IN
(SELECT MemberID as PotentialMatch from qryPreviouslyMatched)
AND
MemberID <> me.memberID.

would work
 

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

Similar Threads

Nier Automata 8
Design help 9
help with ranking in a query 2
Brain freeze 2
Access Query problem 1
Need some help with complicated (for me) formulas 5
Problem creating a form for blank records 11
Excel Excel conundrum - I've tried and tried, but 10

Top