using total number of records for random number

S

scubadiver

Hello,

I am trying to figure out a way to select one record at random out of almost
400,000 records.

I decided the easiest way would be to select a random number using the
record ID(which is consecutive), inserting it into a text box and using a
filtered query.

Text1 = Int((371725 * Rnd) + 1)

What I would like to do is find out whether I can replace the number with a
reference so that when the number of records change, I won't need to change
the VB.

thanks
 
S

scubadiver

thanks.

Douglas J. Steele said:
Text1 = Int((DCount("*", "[NameOfTable]") * Rnd) + 1)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scubadiver said:
Hello,

I am trying to figure out a way to select one record at random out of
almost
400,000 records.

I decided the easiest way would be to select a random number using the
record ID(which is consecutive), inserting it into a text box and using a
filtered query.

Text1 = Int((371725 * Rnd) + 1)

What I would like to do is find out whether I can replace the number with
a
reference so that when the number of records change, I won't need to
change
the VB.

thanks
 

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