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.
 

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