shuffling a list or random mixing

  • Thread starter Thread starter Kass
  • Start date Start date
K

Kass

I need to shuffle a list. I've used a query to pull out a
group of records for our soccer program. Now I need to
take those records and randomly shuffle them so that I
can then divide them onto teams (like drawing kids names
out of a hat to divide them onto teams). Anyone know a
way to do that?
 
Use the Rnd() function, with your primary key, in the ORDER BY clause of the
query:
ORDER BY Rnd([MyID])

The Rnd() function does not actually do anything with the autonumber, but if
you do not pass in a value that changes on each line, the query optimizer
does not bother calling the function eacht time.

Remember to Randomize once each session (e.g. AutoExec macro) so the
sequences are not repeated.
 
Back
Top