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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random number 1

Status
Not open for further replies.

accjrf

Technical User
Apr 1, 2004
39
US
I am trying to use the rnd function to give me a random number as an authorization number. I only call this routine a couple of times a day and store the auth number in a table. After using this for a week, I realized that every time I close Access and reopen it, the so-called "random" number repeats itself. How can I avoid getting duplicates every time I start Access?

Here is my code:

MyValue = Int((999999 * Rnd)+1)
 
Before calling the rnd, you should call Randomize.

So:

Randomize
MyValue = Int((999999 * Rnd)+1)

Randomize is what seeds the table.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Hi.

I am using a checksum of a replication ID as an authorization in an app. Curious how you are using a random number?

Thanks,
ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top