Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    May 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change Password (access97)

    I have User Level Security set up on my database. Is there a way if I don't have any toolbars enabled to allow users to change their password? Can I put a command button on a form and have the security manager open so that the user can change their password? Is there another way to do this? I am open to any suggestions!

  2. #2
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    Do you have the Access97 Developer's Handbook? There is a form included on the CD along with a standard module that allows users to change their password and only theirs as long as they are not members of the admins group. If you don't have the book I highly recommend it for this as well as many other usefull things.

  3. #3
    Lounger
    Join Date
    May 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    I don't have the book, but is there any other way that I can get the form?

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    Look in the help file for "NewPassword Method".
    There is a sample of a function to create users and change their passwords.
    Francois

  5. #5
    Lounger
    Join Date
    May 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    do you know of any examples without creating the user first.
    The current user can change their password!!!

  6. #6
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    You can modify the code example by setting the user object variable to the CurrentUser. Then use a second inputbox to prompt the user for their old password. Get rid of the code referring to groups and you should be set.

  7. #7
    Lounger
    Join Date
    May 2002
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    I have the code working with one minor problem.
    I have set up a form that has 3 text boxes for Old Password, New Pass, Verify. If the user does not have an old password then they need to leave the old password box blank. I get an error saying that it is an Invaild use of Null. I know there is a way to fix this but I cant remember!

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    Easy - if Old Password is null, make it an empty string.

    OldPassword=NZ(OldPassword)

  9. #9
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Password (access97)

    I modify the sample code of the help file and come to this :
    <pre>Sub NewPasswordX()
    Dim wrkDefault As Workspace
    Dim usrNew As User
    Dim strNewPassword As String
    Dim strOldPassword As String
    ' Get default workspace.
    Set wrkDefault = DBEngine.Workspaces(0)
    Set usrNew = wrkDefault.Users(CurrentUser)
    With wrkDefault
    ' Ask user for new password. If input is too long, ask
    ' again.
    Do While True
    strOldPassword = InputBox("Enter old password:")
    strNewPassword = InputBox("Enter new password:")
    Select Case Len(strNewPassword)
    Case 1 To 14
    usrNew.NewPassword strOldPassword, strNewPassword
    MsgBox "Password changed!"
    Exit Do
    Case Is > 14
    MsgBox "Password too long!"
    Case 0
    Exit Do
    End Select
    Loop
    End With
    End Sub</pre>

    To invoke the sub use :
    Call NewPasswordX()
    I test the code, but for sure test this on a copy of your database and your mdw file.
    Francois

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •