[AccessD] Random Password generator

Erwin Craps Erwin.Craps at ithelps.be
Tue May 20 02:14:43 CDT 2003


Can be used in a update query thx to dummyfield


Function GeneratePassWord(Optional intPasswordLength As Integer, Optional
varDummyField As Variant)
    ' Comments  :
    ' Parameters: intPasswordLength
    '             varDummyField -
    ' Returns   :  -
    ' Modified  :
    '
    ' --------------------------------------------------
    'TVCodeTools ErrorEnablerStart
    On Error GoTo PROC_ERR
    'TVCodeTools ErrorEnablerEnd
    
    Dim intTemp As Integer
    
    'varDummyField serves only when using a update query to generate
different passwords.
    
    If intPasswordLength = 0 Then
        intPasswordLength = 8
    End If
    Randomize
    Do Until Len(GeneratePassWord) = intPasswordLength
        intTemp = Int((122 - 48 + 1) * Rnd + 48)
        Select Case intTemp
            Case Is <= 57
            Case Is <= 64
                intTemp = 0
            Case Is <= 90
            Case Is <= 96
                intTemp = 0
        End Select
        If Len(GeneratePassWord) = 0 Then
            Select Case intTemp
                Case Is <= 64
                    intTemp = 0
                Case Is <= 90
                Case Else
                    intTemp = 0
            End Select
        End If
        If intTemp Then
            GeneratePassWord = GeneratePassWord + Chr(intTemp)
        End If
    Loop
    
    
    'TVCodeTools ErrorHandlerStart
PROC_EXIT:
    On Error Resume Next
    Exit Function
    
PROC_ERR:
    Select Case Err
        Case 0
            'Do Nothing
        Case Else
            MsgBox Err.Description, vbOK, "ERROR:" & Err.Number
            Resume PROC_EXIT
    End Select
    'TVCodeTools ErrorHandlerEnd
    
End Function


-----Oorspronkelijk bericht-----
Van: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] 
Verzonden: maandag 19 mei 2003 19:19
Aan: accessd at databaseadvisors.com
Onderwerp: Re: [AccessD] Random Password generator


Joe:

Chr(Int((26 * Rnd) + 65)) will give you random upper case characters A
through Z.

Rocky

----- Original Message ----- 
From: "Joe Rojas" <JRojas at tnco-inc.com>
To: <accessd at databaseadvisors.com>
Sent: Monday, May 19, 2003 9:57 AM
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
>


_______________________________________________
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