[AccessD] Random Password generator

Neal Kling nkling at co.montgomery.ny.us
Mon May 19 12:10:52 CDT 2003


Here's one from my pile o' functions.  As you can see I didn't write it;
Looks like it could use some cleaning up.

Neal Kling
Lotus, isn't that some kind of fancy flower?


'***********************************************************************
****
**********
'* Name:     PassWrdGen Function
'* Written:  11/15/1999 by Patricia OConnor
'* Args:     varNumChar
'* Returns:  strPssWrd - string of password
'* Purpose:  Create Random PassWord of intNumChar number of characters.
If 
'*           varNumChar is null then default is 8
'***********************************************************************
****
**********
Function PassWrdGen(Optional varNumChar As Variant) As String
    Dim intNumChar As Integer
    Dim intChar As Integer
    Dim idx As Integer
    Dim strPssWrd As String
    
    If IsMissing(varNumChar) Or IsNull(varNumChar) Or (Not
IsNumeric(varNumChar)) Then
        intNumChar = 8
    Else
        intNumChar = Int(varNumChar)
    End If
    Randomize
    
    For idx = 1 To intNumChar
        intChar = Int((122 - 48 + 1) * Rnd + 48)
        Select Case intChar
        Case 48 To 57, 65 To 90, 97 To 122
            strPssWrd = strPssWrd & Chr$(intChar)
        End Select
    Next
    PassWrdGen = strPssWrd
    
End Function



-----Original Message-----
From: Joe Rojas [mailto:JRojas at tnco-inc.com]
Sent: Monday, May 19, 2003 12:58 PM
To: 'accessd at databaseadvisors.com'
Subject: [AccessD] Random Password generator


Hi All,

Does anyone have a routine that will generate a random alphanumeric
string?
I would also like to be able to specify a length.

If not, does anyone have an idea of how to achieve such a thing?

Thanks,
Joe R.



This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please
notify
the sender as soon as possible and destroy this message. While TNCO,
Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability
for
any damage caused by any virus transmitted by this email.
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list