Results 1 to 5 of 5
  1. #1
    ducecoop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    41

    Still having problems generating unique Password

    Access 2003



    I am trying to generate unique passwords to a particular format on the "After Update" of an event.

    With the help of people here I am getting new passwords in the correct format
    HOWEVER
    When I close the application and reopen it it starts with the same password everytime and the second generated password is always the same and so on.

    So it does not seem to be actually generating Unique passwords

    Here is my code

    Code:
    Public Function RndPass() As String
    '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)
        RndPass = passwd
    End Function
    Code:
    Public Function UniquePass() As String
        Dim passwd As String
        Dim passwd2 As String
        Dim i As Integer
        Do
            passwd = RndPass
        Loop While DLookup("ComputerPassword", "tblPeople", "ComputerPassword='" & passwd & "'") > ""
    'disorder password
        passwd2 = ""
        Do While passwd <> ""
            i = Int(Len(passwd) * Rnd) + 1
            passwd2 = passwd2 + Mid(passwd, i, 1)
            passwd = Mid(passwd, 1, i - 1) + Mid(passwd, i + 1)
        Loop
        UniquePass = passwd2
    End Function
    Code:
    Private Sub LastName_AfterUpdate()
    
    
    Me.ComputerPassword.Value = UniquePass
    Me.ComputerUser = LCase(Left([FirstName], 1)) & "" & LCase(Replace(Replace(Replace([LastName], "-", ""), " ", ""), "ñ", "n"))
    
    Me.EmailPass.Value = Me.ComputerPassword.Value
    Me.EmailUser = LCase(Left([FirstName], 1)) & "" & LCase(Replace(Replace(Replace([LastName], "-", ""), " ", ""), "ñ", "n"))
    
    
    
    
    End Sub
    Can anybody assist in tweeking my code so it does indeed generate unique passwords

    tia

    Dave

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    you can put RANDOMIZE in the beginning of the function:
    Code:
    Public Function UniquePass() As String
        Dim passwd As String
        Dim passwd2 As String
        Dim i As Integer
        randomize
        Do
            passwd = RndPass

  3. #3
    ducecoop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    41
    Quote Originally Posted by weekend00 View Post
    you can put RANDOMIZE in the beginning of the function:
    Code:
    Public Function UniquePass() As String
        Dim passwd As String
        Dim passwd2 As String
        Dim i As Integer
        randomize
        Do
            passwd = RndPass
    That appears to have solved it.

    Thanks again

    Dave

  4. #4
    Mrcams is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    10

    hello

    How this random password stuff works?

  5. #5
    ducecoop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    41
    Quote Originally Posted by Mrcams View Post
    How this random password stuff works?
    After I finally got all the pieces put together properly it worked great

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Generating Recurring Tasks.
    By Jamesamorris in forum Access
    Replies: 3
    Last Post: 10-26-2010, 10:46 AM
  2. Generating Report from Form
    By mwabbe in forum Reports
    Replies: 8
    Last Post: 08-30-2010, 12:25 PM
  3. Help in generating product group and Combobox
    By lm_lopes in forum Access
    Replies: 0
    Last Post: 02-28-2010, 05:44 PM
  4. Replies: 5
    Last Post: 07-19-2009, 08:37 AM
  5. Change from old password to new password
    By richy in forum Security
    Replies: 0
    Last Post: 11-17-2005, 05:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums