LittleMan
05-05-2002, 02:36 PM
Right now I'm using the following function to generate passwords:
Function RandomPW(myLength)
Dim X, Y, strPW
For X = 1 To myLength
'Randomize the type of this character
Y = Int((3 * Rnd) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase
Select Case Y
Case 1
'Numeric character
Randomize
strPW = strPW & CHR(Int((9 * Rnd) + 48))
Case 2
'Uppercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 65))
Case 3
'Lowercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 97))
End Select
Next
RandomPW = strPW
End Function
I then store the function later with something like this:
strPassword = RandomPW(8)
And then I can call it throughout an email by using & strPassword &
The problem is that each time I write the & strPassword & it's generating a new password !!! How do I save the origional value so it's only calling the function once.
Thanks,
-Ryan.
Function RandomPW(myLength)
Dim X, Y, strPW
For X = 1 To myLength
'Randomize the type of this character
Y = Int((3 * Rnd) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase
Select Case Y
Case 1
'Numeric character
Randomize
strPW = strPW & CHR(Int((9 * Rnd) + 48))
Case 2
'Uppercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 65))
Case 3
'Lowercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 97))
End Select
Next
RandomPW = strPW
End Function
I then store the function later with something like this:
strPassword = RandomPW(8)
And then I can call it throughout an email by using & strPassword &
The problem is that each time I write the & strPassword & it's generating a new password !!! How do I save the origional value so it's only calling the function once.
Thanks,
-Ryan.