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]
 

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