Assign value based on sort

C

CJ

Hi Groupies!

I am in the final stages of a database for a golf tournament and I would
like to automate the flighting, hole assignment and tee time for the final
round.

I have a query (qrySatFlights) that calculates a total score based on the
first two rounds of golf, the field is called SubTotal. Based on the value
in SubTotal, I would like Access to assign the correct values in the Flights
field, the SatHole field and the SatTeeTime field.

Here is what needs to happen:

For the first 9 flights there are 16 golfers.

The 16 players with the lowest SubTotal go in the Championship Flight.
1 - 4 start at hole 1a at 1pm
5 - 8 start at hole 1b at 1pm
9 - 12 start at hole 2a at 1pm
13 - 16 start at hole 2b at 1pm

The next 16 are in Flight 1 starting at hole 3a, and so on, up to 144
golfers.

For flights 9 - 16 there are 18 people per flight (golfers 145 - 288)

Flight 9:
145 - 148 start at hole 1a at 7am
149 - 152 start at hole 1b at 7am
153 - 156 start at hole 2a at 7am
157 - 160 start at hole 2b at 7am
161 - 162 start at hole 3a at 7am

Flight 10
163 - 164 start at hole 3a at 7am
165 - 168 start at hole 3b at 7am
etc
etc

I am not sure if I should be doing this in a query or on a form with code
behind a command button.

In a query I was thinking that I would somehow have access assign a sort
order value and then (with a giant IF statement?) assign the results.
On a form I think I would have to use CASE (not sure how).

Thus my dilemma. I'm not sure what would be best or how to get going.

If somebody can get me started on the code or whatever, I should be able to
figure out the rest.
 
C

CJ

Problem solved via thread Apply Select Case To All Records.

CJ said:
Hi Groupies!

I am in the final stages of a database for a golf tournament and I would
like to automate the flighting, hole assignment and tee time for the final
round.

I have a query (qrySatFlights) that calculates a total score based on the
first two rounds of golf, the field is called SubTotal. Based on the value
in SubTotal, I would like Access to assign the correct values in the
Flights field, the SatHole field and the SatTeeTime field.

Here is what needs to happen:

For the first 9 flights there are 16 golfers.

The 16 players with the lowest SubTotal go in the Championship Flight.
1 - 4 start at hole 1a at 1pm
5 - 8 start at hole 1b at 1pm
9 - 12 start at hole 2a at 1pm
13 - 16 start at hole 2b at 1pm

The next 16 are in Flight 1 starting at hole 3a, and so on, up to 144
golfers.

For flights 9 - 16 there are 18 people per flight (golfers 145 - 288)

Flight 9:
145 - 148 start at hole 1a at 7am
149 - 152 start at hole 1b at 7am
153 - 156 start at hole 2a at 7am
157 - 160 start at hole 2b at 7am
161 - 162 start at hole 3a at 7am

Flight 10
163 - 164 start at hole 3a at 7am
165 - 168 start at hole 3b at 7am
etc
etc

I am not sure if I should be doing this in a query or on a form with code
behind a command button.

In a query I was thinking that I would somehow have access assign a sort
order value and then (with a giant IF statement?) assign the results.
On a form I think I would have to use CASE (not sure how).

Thus my dilemma. I'm not sure what would be best or how to get going.

If somebody can get me started on the code or whatever, I should be able
to figure out the rest.
 

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