How to random select pictures on an ACCESS 2007 form

  • Thread starter Thread starter wmuirhead
  • Start date Start date
W

wmuirhead

I would like to have a form randomly select pictures from say 20 images as
one moves from one entry to the next.
 
I assume you have the pictures in a specific folder and you are using a
hyperlink field to point to the image to load. If you are doing this, you
could add a numeric (Long Integer would be best) field to the table that
holds the hyperlinks.

Then use a random number routine that will return a number within the range
of numbers in your table. Use the returned number to retrieve the record
with the matching number.

This code will return a number between 1 and 20:

Randomize
intNewNumber = Int((20 * Rnd) + 1)
 
Back
Top