G
Guest
Can anyone tell me how I can generate a random 11-digit alphanumeric number?
Much thanks,
Clint
Much thanks,
Clint
John said:Ok, can you be a bit more specific on what you want? A random alpha
numeric string can be generated by using a random number generator to
generate a number 8 times that is between x and y and then using that in
combination with Chr(n) to return a number or letter.
Do you have any rules on generating the 8-character string? Here are
some possible rules - some of them conflict with other
-- Only numbers and Letters
-- All upper case
-- All lower case
-- No spaces
-- at least one number
-- at least one letter
-- Must start with a letter
-- must start with a number
-- every character must be unique
-- no adjacent characters can be alike
-- any 8 characters from Asc(48) to Asc(125)
The code for the last would be something like the following using the
RandomNumber function I posted earlier.
For I = 1 to 8
YourString = YourString & Chr(CLng(RandomNumber(48,125)))
Next I
'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
[quoted text clipped - 12 lines]Thanks for the code ref, but I need to come up with an alphanumeric string,
nut just a numeric string. If you have any refs for something like this, I