Access 2003
I am using the following code on the AfterUpdate event of a field event
to generate a random password in another 2 fields.
seems to often give the same password but then sometime change to something different and again stays the same for awhile.
Code:
Private Sub LastName_AfterUpdate()
'1 Capital Letter
'2 lower case letters
'3 numbers
'1 special character
Dim passwd As String
Const specialChar = "!@#$%&*_?+"
'1 Capital Letter
passwd = Chr(Int(26 * Rnd) + Asc("A"))
'2 lower case letters
passwd = passwd + Chr(Int(26 * Rnd) + Asc("a"))
passwd = passwd + Chr(Int(26 * Rnd) + Asc("a"))
'3 numbers
passwd = passwd + Format(Int(1000 * Rnd), "000")
'1 special character
passwd = passwd + Mid(specialChar, Int(Len(specialChar) * Rnd) + 1, 1)
Me.ComputerPassword.Value = passwd
Me.ComputerUser = LCase(Left([FirstName], 1)) & "" & LCase(Replace(Replace(Replace([LastName], "-", ""), " ", ""), "ñ", "n"))
Me.EmailPass.Value = passwd
Me.EmailUser = LCase(Left([FirstName], 1)) & "" & LCase(Replace(Replace(Replace([LastName], "-", ""), " ", ""), "ñ", "n"))
End Sub
This is generated on a pop-up form
Any ideas that how I can make this unique?