random records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Access 2000. I have a list of file numbers - essentially the same
as a list of purchase orders, that are numerical - and I wish to pull a
random sample of those file numbers out of that larger list. Further I wish
to be able to pull a certain size of sample based on a location's total
population of file numbers or orders. For example for a location with a 1000
orders, I wish to get 50 orders, and a location that has 5000 orders, I want
to get a sample of 250.
 
I am using Access 2000. I have a list of file numbers - essentially the same
as a list of purchase orders, that are numerical - and I wish to pull a
random sample of those file numbers out of that larger list. Further I wish
to be able to pull a certain size of sample based on a location's total
population of file numbers or orders. For example for a location with a 1000
orders, I wish to get 50 orders, and a location that has 5000 orders, I want
to get a sample of 250.

Try something like

SELECT TOP 5 PERCENT
field, field, field, field
FROM yourtable
ORDER BY Rnd([ID]);

where ID is some non-negative integer field in your table.

John W. Vinson[MVP]
 
Back
Top