Hi,
I am organizing a day where men massage women (round 1) and vice versa (round 2).
In this example I will only focus on the first round, using 3 men and 3 women (in real, there are 6 of both sexes).
The men (m1, m2, m3) give each of the women (f1, f2, f3) a score, indicating how much they would like to give a massage to this woman.
The women give each of the man a score indicating how much they would like to receive a massage from this man.
Both scores are combined into a single pair-score. This results in the following query 'pairscore'.
Both giver and receiver are in fact columns containing id's pointing to a table person (id, name, sex).
giver receiver score
m1 f1 2,4
m1 f2 2
m1 f3 1,6
m2 f1 2,4
m2 f2 2,1
m2 f3 2,0
m3 f1 3
m3 f2 2,5
m3 f3 1,8
Now, I would like to generate all possible setups, each containing (in this example) 3 valid massage-pairs.
setup giver receiver score
1 m1 f1 2,4
1 m2 f2 2,1
1 m3 f3 1,6
2 m1 f1 ...
2 m2 f3
2 m3 f2
3 m1 f2
3 m2 f1
3 m3 f3
4 m1 f2
4 m2 f3
4 m3 f1
5 m1 f3
5 m2 f1
5 m3 f2
6 m1 f3
6 m2 f2
6 m3 f1
This query would permit me to give each setup a setup-score, by calculating the mean score fo all pairs in the setup for example.
Now my questions are:
1. How do I create a query that generates all setups as shown above, for N men/women.
2. If such a query is not possible, what VBA code will do the job.
I am using MS access 2007.
Thank you in advance for any attempt to help me.
Kind regards,
Edwin
The Netherlands
I am organizing a day where men massage women (round 1) and vice versa (round 2).
In this example I will only focus on the first round, using 3 men and 3 women (in real, there are 6 of both sexes).
The men (m1, m2, m3) give each of the women (f1, f2, f3) a score, indicating how much they would like to give a massage to this woman.
The women give each of the man a score indicating how much they would like to receive a massage from this man.
Both scores are combined into a single pair-score. This results in the following query 'pairscore'.
Both giver and receiver are in fact columns containing id's pointing to a table person (id, name, sex).
giver receiver score
m1 f1 2,4
m1 f2 2
m1 f3 1,6
m2 f1 2,4
m2 f2 2,1
m2 f3 2,0
m3 f1 3
m3 f2 2,5
m3 f3 1,8
Now, I would like to generate all possible setups, each containing (in this example) 3 valid massage-pairs.
setup giver receiver score
1 m1 f1 2,4
1 m2 f2 2,1
1 m3 f3 1,6
2 m1 f1 ...
2 m2 f3
2 m3 f2
3 m1 f2
3 m2 f1
3 m3 f3
4 m1 f2
4 m2 f3
4 m3 f1
5 m1 f3
5 m2 f1
5 m3 f2
6 m1 f3
6 m2 f2
6 m3 f1
This query would permit me to give each setup a setup-score, by calculating the mean score fo all pairs in the setup for example.
Now my questions are:
1. How do I create a query that generates all setups as shown above, for N men/women.
2. If such a query is not possible, what VBA code will do the job.
I am using MS access 2007.
Thank you in advance for any attempt to help me.
Kind regards,
Edwin
The Netherlands