Re: Change Password by User
- From: satdist@xxxxxxxxx
- Date: 1 Jan 2007 08:05:42 -0800
Thank you very much 69 Camoaro for the help....worked just as needed. I
have another issue I need clarification on. There are two people with
Admin privledges and 28 users with limited privledges, is there a code
I can use at log on that will open a certain form by user or group?
Thanks again you made my day.
'69 Camaro wrote:
Hi.
I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing.
Since you don't describe what error message or failures you're getting, "no
luck" doesn't really tell us what your problem might be. However, the easiest
way to allow the user to change his own password is by putting a button on a
form, place [Event Procedure] in the button's OnClick( ) event, and paste this
code in the form's module, ensuring the name of the button matches what is
ChgUsersPswdBtn in this example, then save and compile the code.
Private Sub ChgUsersPswdBtn_Click()
On Error GoTo ErrHandler
SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts
Exit Sub
ErrHandler:
MsgBox "Error in ChgUsersPswdBtn_Click( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub ' ChgUsersPswdBtn_Click( )
Open the form in Form View and select the button to open the Change Logon
Password dialog window.
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
<satdist@xxxxxxxxx> wrote in message
news:1167599679.966838.113380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a multi user database that is secure and split. I am looking for
the details of how to add a user password change form. I have tried
numerous times using what I could find in this group as far as
instructions and no luck, there has to be some detail I'm missing. The
following are the last instructions I've tried:
Create a form with the following textboxes:
Current User: set the Control Source =CurrentUser()
OldPW (old password)
NewPW (new password)
ConfirmPW (confirm password)
Add a command button, call it cmdSetPassword and drop in the following
procedure in the Click event
Private Sub cmdSetPassword_Click()
'Change the user's password. Confirm that the passwords typed are the
same.
Dim curr_user As User
On Error Goto FailedPW
If Me.NewPW <> Me.ConfirmPW Then
MsgBox "New passwords are not identical. Please retype
passwords and
try again.", _
vbOKOnly, "Change Password Failed"
Exit Sub
End If
If Len(Me.NewPW) < 4 Or Len(Me.NewPW) > 14 Or IsNull(Me.NewPW) Then
MsgBox "New passwords must be between 4 and 14 characters.",
vbOKOnly, "Change Password Failed"
Exit Sub
End If
Set curr_user = DBEngine.Workspaces(0).Users(CurrentUser())
If IsNull(Me.OldPW) Then
curr_user.NewPassword "", Me.NewPW
Else
curr_user.NewPassword Me.OldPW, Me.NewPW
End If
MsgBox "Your new password has been set and will take effect the
next
time you log on.", _
vbOKOnly, "Password confirmed"
DoCmd.RunCommand acCmdClose
Exit Sub
FailedPW:
If Err.Number = 3033 Then
MsgBox "Old password is incorrect. Please retype and try
again.",
vbOKOnly, "Change Password Failed"
Me.OldPW.SetFocus
Else
MsgBox "Error number " & Err.Number & ": " & Err.Description
End If
End Sub
Thanks for any help you can give.
.
- Follow-Ups:
- Re: Change Password by User
- From: '69 Camaro
- Re: Change Password by User
- References:
- Change Password by User
- From: satdist
- Re: Change Password by User
- From: '69 Camaro
- Change Password by User
- Prev by Date: Re: Change Password by User
- Next by Date: Re: Change Password by User
- Previous by thread: Re: Change Password by User
- Next by thread: Re: Change Password by User
- Index(es):