Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Numbers

Status
Not open for further replies.

klyon

Technical User
Jun 27, 2002
10
US
Hi All -

I'm looking for a way to add a random number field to an existing table in Access 2000.

I've not been successful with the rand or random functions.

Thanks,

-Kris
 
Although at first glance I found the below to be top heavy (produced more higher numbers than lower ones), after much testing and usage it appears to be right on target....

Randomize
somevariable = Int((9-0+1)*Rnd+0)

will give you a random number between 0 and 9.....adjust the ends as necessary. Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III, MCP, Network+, A+
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
One more note....you should always include a randomize statement either directly before or directly after every Rnd call....I choose to put it before very call.....this will reseed the random list at every call.... Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III, MCP, Network+, A+
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top