Randomly pick 5 records to print

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

Guest

I have a database written in Access 2003. I have a report that is based on a
query and a filter. The report may generate anywhere from 0 records to 1000+
records. I want the report to randomly pick only 5 of the records to actually
print. I want this to be a pure randomization of all of the records supplied
by the query and filter. And, of course, it should also be able to print all
records if there are 5 or less. Thank you.
 
Try this --
SELECT TOP X YourFieldNames, ...
Replace the "X" with the quanity of records you want.

If your table has an autonumber field then you can use a calculated field to
simulate a random number.
Right(Left((4.6345679/ [AutoNUM]) *10,000)5),3)
Sort it ascending.

For a different group use a different number than 4.6345679 in the formula.
 
Back
Top