You can get a random sample by sorting the records on a random value like
this:
SELECT TOP 10 Table1.* FROM MyTable ORDER BY Rnd([ID]);
Notes:
1. You must issue a Randomize before running this. Otherwise VBA gives you
the same sequence of random numbers.
2. The Rnd() does not do anything with the primary key value you pass in,
but if you don't pass one, the query optimizer is too clever and doesn't
bother calling the function at every row.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Dave said:
How can I write a query that will return a list of random records from a
table?
The table has an autonumber value and I want it get a random set of
auto-generated numbers with each query.
THanks