Passwords

Access Virgin

Registered User.
Local time
Today, 18:54
Joined
Apr 8, 2003
Messages
77
I have to allocate passwords for organisations held in a database. There are 5000 at the minute and this will grow. Is there anyway to automatically generate passwords as you can imagine that finding 5000+ different passwords would be impossible? The preferred format would be letters and then a number(s). Ive been told that they can be generated using Excel but ive looked through the help but cant find anything.

Any suggestions?
 
Here is a function that will generate random passwords, you will most likely need to tweak it for your enviroment.
Code:
Function Assign_Password(PWlen As Integer) As String
  ' set initial seed
  Randomize Timer
  Dim LP As Integer, C As Integer, S As Integer
  For LP = 1 To PWlen
    If LP = 1 Then
      ' Always start password with an uppercase
      S = LP
    Else
      ' randomly select Upper, Lower case or number
      S = Int((3 - 1 + 1) * Rnd + 1)
    End If
    Select Case S
      Case 1
        ' Generate Upper Case Letter
        C = Int((90 - 65 + 1) * Rnd + 65)
      Case 2
        ' Generate Lower Case Letter
        C = Int((122 - 97 + 1) * Rnd + 97)
      Case 3
        ' Generate Number
        C = Int((57 - 48 + 1) * Rnd + 48)
    End Select
    ' Safety check
    If C > 0 Then
      Assign_Password = Assign_Password & Chr(C)
    Else
      LP = LP - 1
    End If
  Next LP
End Function
 
You could use the random number generater to pick random numbers and then translate the results back to the letters.
If you wanted the characters to be between 4 and 6 and a 2 digit number at the end you could do this:

Code:
Function RanPass() As String
    'Random Password Generator
    'By Flobob
    
    Dim name As String
    Dim I As Integer
    
    For I = 1 To Int((3 * Rnd) + 4) 'pick random number of characters between 4 and 6
        name = name & Chr(Int((26 * Rnd) + 97)) 'Pick a letter
    Next I
    name = name & Trim(Str(Int((89 * Rnd) + 10))) 'Pick a two digit number
    
    RanPass = name

End Function

This will return some interesting passwords and if you want them all in upper and lower case you would have to random two seperate set of numbers. I hope this helps let me know if you have any questions. You will probably want to check to see if that password is already used etc but you coudl do that elsewhere and recall the function if you need a new one.
 
Last edited:
Welp nevermind it looks like I got beaten to the punch P...
 

Users who are viewing this thread

Back
Top Bottom