By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

Randomly chosen record

P: n/a
Hi all

Anyone help me find a way of randomly selecting a record from a table
for display on a form. Do I need to somehow re-seed the random
generator?

I am sure there must be an easy, simple way but it has me foxed!

Hoping someone can help

Regards

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you don't reseed the random number generator you'll always get the same
"random" numbers. To reseed the generator, use the Randomize command. To
then pull a record, create a number from the random number received that is
between the lowest and highest record ID number (inclusively) in the
recordset and move to that record.

The Rnd function returns a number >=0 And <1. To get a number in the range
you are looking for, there is a formula in the help file.

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

--
Wayne Morgan
MS Access MVP
"Ken Gray" <ke*****@speed-mail.co.uk> wrote in message
news:41**************@news.ispserve.co.uk...
Hi all

Anyone help me find a way of randomly selecting a record from a table
for display on a form. Do I need to somehow re-seed the random
generator?

I am sure there must be an easy, simple way but it has me foxed!

Hoping someone can help

Regards

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.