random rows

  • Thread starter Thread starter Scott Reynolds
  • Start date Start date
S

Scott Reynolds

Hello!

Is it possible to select random rows from the table.

Thank you in advance!
Scott
 
Scott,

You can do it with a little trick, using Access's built-in function Rnd(),
which returns random numbers between 0 and 1.
Make a query on the table, and add a calculated field in thequery grid, with
the expression:

RandomID: Rnd([SomeFieldName])

Change SomeFieldName in the expression above to the name of any other field
in your query; it doesn't matter which, this is only in order to force Rnd()
to return a new value in each record. Set the sorting to either Ascendig or
Descending on this calculated field, and set the query's Top Values property
to the desired number of records to be returned. The records rerturned will
be dirrerent each time.

HTH,
Nikos
 

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

Similar Threads

Black rectangle 2
Needed:Random rows.... 4
indexing in a table 4
Create all dates for a year in a query 3
Random numbers 9
Random Sampling 2
Access 2003 Form Crashing! 4
Random Selection 1

Back
Top