Mitchel Volk said:
I am working on a vender database. After selecting a group of venders from a
table, I need to select 6 venders from that list RANDOMALLY to produce a report.
Thanks in advance.
Hi Mitchel,
The typical method is to sort your
records randomly using the Rnd function,
then choose the top 6.
Something like these examples
from Jon and Michel:
SELECT Top 6 Customers.*
FROM Customers
ORDER BY Rnd(1 + Len([CompanyName] & ""));
or if you have an AutoNumber as a Primary Key:
SELECT Top 6 Categories.*
FROM Categories
ORDER BY Rnd([CategoryID]);
Rnd() needs a non-negative, non-zero, non-null argument.
or this example from John Viescas:
SELECT Top 6 tblZips.Zipcode,
tblZips.City, tblZips.State,
FROM tblZips
ORDER BY Rnd(Asc(Left([city],1)));
Please respond back if I misunderstood
or was not clear about something.
Good luck,
Gary Walter