Randomly choose a subset of records to audit.

G

Guest

I want to choose a subset of records in a query to audit. For example, in a
query with 200 records, I want to randomly select every 20 records to output
to a report. It does not need to be completely random - selecting every 10th
record would also work.
 
J

John Spencer (MVP)

Do you have some unique id number on the records? Or do you have some primary
key that can be used to rank the records?

Assuming an autonumber field, the simplest solution would be

Field: Every20th: AutonumberField mod 20
Criteria: 1

That would get the records that ended in 01,21,41,61 and 81.

Changing the Mod 20 to Mod 10 would get any record ending in 1. While changing
the criteria From 0 to the mod number minus one, would change which record in
the group.

If you really need a random selection, you can use the Randomize and Rnd
functions to assign values to rows in the column and then extract specific values.
 

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