Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User can change password? 3

Status
Not open for further replies.

merlin72

Programmer
Apr 18, 2000
50
US
How can i place on the form a button that will allow the user to change there user password.
Regards
Jim.


 
I dont know if is possible to place a bottom in the form, but you can place a option the menu, custom your task bar.
 
What password do you want to change? If you mean a network password, I can't help you. But if you mean an Access User Account password, do the following:

1. Create a small form to prompt the user for a new password.
2. Set the following Form properties:
Caption: Change Password
Scroll Bars: Neither
Record Selectors: No
Navigation Buttons: No
Auto Center: Yes
Modal: Yes
Border Style: Dialog
Min Max Buttons: None
3. Add unbound text boxes for Old Password, New Password, and Verify Password. Name them txtOldPassword, txtNewPassword, and txtVerifyPassword, respectively.
4. Set the Input Mask for each of these to "PASSWORD".
5. Add OK and Cancel buttons.
6. Create the following event procedures:
Code:
Private Sub cmdCancel_Click()
    DoCmd.Close
End Sub

Private Sub cmdOK_Click()
    Dim wsp As Workspace
    If Nz(txtNewPassword) <> Nz(txtVerifyPassword) Then
        txtVerifyPassword.SetFocus
        Beep
        MsgBox &quot;Verify the new password by retyping it in the Verify box and clicking OK.&quot;, vbInformation
        Exit Sub
    End If
    Set wsp = DBEngine.Workspaces(0)
    On Error GoTo ErrorHandler
    wsp.Users(CurrentUser).NewPassword Nz(txtOldPassword), Nz(txtNewPassword)
    DoCmd.Close
ErrorExit:
    Set wsp = Nothing
    Exit Sub
ErrorHandler:
    If Err = 3033 Then
        txtOldPassword.SetFocus
        Beep
        MsgBox &quot;The password you entered in the Old Password box is incorrect.&quot; _
            &amp; vbCrLf &amp; vbCrLf _
            &amp; &quot;Please enter the correct password for this account.&quot;, _
            vbInformation
        Resume ErrorExit
    End If
    Err.Raise Err.Number
End Sub
7. Save the form with the name Change Password
8. Place a Change Password button on your original form.
9. Add the following event procedure to that form:
Code:
Private Sub cmdChangePassword_Click()
    DoCmd.OpenForm &quot;Change Password&quot;, , , , , acDialog
End Sub

Note: If you are using Access 2000, make sure you set a reference to Microsoft DAO 3.6 Object Library.
 
Thank You! This worked out great.
Regards
Jim.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top