View Single Post
  #2 (permalink)  
Old October 3rd, 2007, 10:50 AM
allenm allenm is offline
Friend of Wrox
Points: 513, Level: 8
Points: 513, Level: 8 Points: 513, Level: 8 Points: 513, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Feb 2007
Location: Davenport, IA, USA.
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts

Should the code contain just numbers? Just Letters? A mixture? Are the first few letters and the last few numbers? Is the code completely random? Are duplicate codes acceptable?

There isn't very much information to go on to generate a solution for.

If you just want a random set of numbers extended to 13 digits, then this would work:
Dim iCnt As Integer, sCode As String
For iCnt = 1 to 13
  sCode = sCode & Int((Rnd * 10)) 'Concatenates random number between 0 and 9
MsgBox "The generated code is: " & sCode

The above doesn't check to see if there was a duplicate. You'd have to check the result against a list for that.
If you are looking for anything more specific then more information on what is desired is needed.

Reply With Quote