Randomly choose a subset of records to audit.

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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.
 
Back
Top