unique ID in Access

  • Thread starter Thread starter Mohammad Mobin
  • Start date Start date
M

Mohammad Mobin

How can i generate about 60,000 unique IDs of 8 digits or 16 digits?
(alphanumeric characters)
 
Mohammad Mobin said:
How can i generate about 60,000 unique IDs of 8 digits or 16 digits?
(alphanumeric characters)

Lookup the rnd function in VBA help. Don't forget to run the
Randomizer function first.

I was going to suggest multiplying the number by 100,000,000 to get
your eight digits however the Rnd function returns a Single which
doesn't have enough digits.

"Single (single-precision floating-point) variables are stored as IEEE
32-bit (4-byte) floating-point numbers, ranging in value from
-3.402823E38 to -1.401298E-45 for negative values and from
1.401298E-45 to 3.402823E38 for positive values."

Ah, and now I notice the requirement for alphanumeric. Presumably 0-9
and A-Z. What about lowercase?

Anyhow I don't know the answer so ignore everything I've typed.
<smile>

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "PasswordGenerator.mdb" which creates a random password of a
given length. Passwords are composed of numbers, lower case letters, and
upper case letters. You can find it here:
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=299

The sample is designed to create a single password, but it could be modified
to create as many unique values as required.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Ah, and now I notice the requirement for alphanumeric. Presumably
0-9 and A-Z. What about lowercase?

Well, you could populate an array randomly with your alphanumeric
characters. Then you could use a random number to choose a character
from that array. It would be pretty intensive as you'd have to run
Rnd() 8 times for each.

Another approach might be to do something like
Rnd()*1000000000000000 and then parse 2 digits at a time into
alphanumeric characters. That would get you 7 alphanumeric
characters with a single digit left over, to which you could add 65.

But it's still pretty processor-intensive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top