Click to See Complete Forum and Search --> : random posts?


Mario
March 4th, 1999, 04:32 PM
I doing a program in visual basic,but I have some problem with Randomize.I wonder if someone know how to do if you have a database and want the program to pick random post from the database and show them in a text field when you push a button.

Thanks for your time.

Mario Gustavsson

Vinayak Sapre
March 7th, 1999, 02:53 PM
Radomize and rnd function together generate psuedo-random number. It's between 0 & 1 .


Check number of records in DB. say n,

Int((n * Rnd) + 1) ' Generate random value between 1 and n.

Now open recordset and do MoveNext for n-1 times. This may not be a appropriate for large number of records though.