Random Password generation

Nick Druce

Registered User.
Local time
Today, 10:28
Joined
Mar 2, 2005
Messages
18
I have a table full of user names and passwords, Is there any way that I can make the database randomly allocate one of these passwords to a user?

Any Help Would be great.
 
Yes using RANDOMIZE and RND and a numeric key.
But an easier way would be to create a query that sorts your password list say by the 5th through 8th characters, then update each persons record with that sorted list (if you are trying to assign them all at one time). It would appear random.
If you are trying to do it "on the fly" when required, wouldn't just generating a random password be easier when required?
 
Random Generation

Thanks for that but how would I go about creating a random password?
 
Nick Druce said:
...how would I go about creating a random password?

I use the below function for this purpose.

Code:
Public Function szRandomPwd() As String
    Dim nResult As Integer
    Dim nCounter As Integer
    Dim szChr As String * 1
    Dim szMakePwd As String
    
    Randomize
    nResult = Int((8 - 6 + 1) * Rnd + 6)  ' a password between 6 and 8 characters long
    nCounter = 0
    Do While nCounter <= nResult
       If Int((0 - -1 + 1) * Rnd + -1) Then  ' random true or false
            'a letter please
            If Int((0 - -1 + 1) * Rnd + -1) Then ' random true or false
                'Upper Case please
                szChr = Chr$(Int((90 - 65 + 1) * Rnd + 65))
            Else
                'Lower Case Please
                szChr = Chr$(Int((122 - 97 + 1) * Rnd + 97))
            End If
        Else
            'a number please  (excluding zero)
            szChr = Chr$(Int((57 - 49 + 1) * Rnd + 49))
        End If
        'exclude zero, one, O, i , l , S etc
        'These characters are eassily confused with other characters
        Select Case szChr
        Case "0", "1", "o", "O", "i", "I", "l", "S", "5", "2", "Z", "7"
            'don't use
        Case Else
            szMakePwd = szMakePwd & szChr
            nCounter = nCounter + 1
        End Select
    Loop
    szRandomPwd = szMakePwd
End Function

HTH

Regards

John
 

Users who are viewing this thread

Back
Top Bottom