Random Sample

J

Jennifer

Hello,
I've read several of posts regarding selecting a random sample, but still
have some questions... I am trying to select a random % of records from a
table. Say I want to select 2% of the total # of records. How do I
incorporate that into the function? Also, our department shys away from the
Module setting. Can I do this through a select query?
Say I use this format: SELECT TOP 400 *
FROM myTable
ORDER BY Rnd(NumericalFieldHere)

Where do I put this information? Does it go under the criteria and what do I
name the field then?

Thanks,
Jennifer
 
P

pietlinden

Hello,
 I've read several of posts regarding selecting a random sample, but still
have some questions... I am trying to select a random % of records from a
table. Say I want to select 2% of the total # of records. How do I
incorporate that into the function? Also, our department shys away from the
Module setting. Can I do this through a select query?
Say I use this format: SELECT TOP 400 *
                                FROM myTable
                                ORDER BY Rnd(NumericalFieldHere)

Where do I put this information? Does it go under the criteria and what do I
name the field then?

Thanks,
Jennifer

I think the only way to do this is to create a query that you can
overwrite and then do the whole thing in VBA.

SELECT TOP 2% *
FROM myTable
ORDER BY

... and then you have to do something like this:

http://www.mvps.org/access/queries/qry0011.htm

(to get a random bunch of records)
 

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

Top