Howdy.
I would do a query to retrieve all the primary keys,
taking care to specify cursor properties that made the
recordset's RecordCount property available.
Then, I would divide the RecordCount property by 5 to get
a sample size (i.e. of there are 82 tips, sample size is
82/5 = 16
Then, I would multiply by a random number and add 1.
1st tip = 1 + (16 * Rnd())
2nd tip = 1 + 16 + (Rnd() * 16)
3rd tip = 1 + 32 + (Rnd() * 16)
4th tip = 1 + 48 + (Rnd() * 16)
5th tip = 1 + 64 + (Rnd() * (82 - 64))
Of course, after calculating each tip number, I would move
to that position in the recordset, retrieve the primary
key value, and then do a lookup and display for that key
value.
You could also pick a random key from the whole range
(i.e. 82) each time, but then you'd have to check for
duplicates.
Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
-----Original Message-----
Hello
I have FAQâ?Ts section in my site with information coming
from a database and I would like to create a random list
of five of those FAQâ?Ts each time the page is loaded. My
question is how the query should look like.