Reset password link with correct username

billmark

Registered User.
Local time
Today, 05:33
Joined
Mar 28, 2012
Messages
25
Hi
I have a frmResetPassword with the following codes but don't know how to link to the correct user who requires to reset. It always resets the 1st user in the tbluser

If Me.txtPassword = Me.txtConfPW Then
MsgBox "Password updated!", vbOKOnly
Me.PWReset = False
DoCmd.Close acForm, "frmPasswordChange"
Else
MsgBox "Passwords don't match, please re-enter!", vbOKOnly
Me.txtPassword.SetFocus
End If
End Sub

My form has the following text boxes:
username
newpassword
confirmnewpassword

Please help.

Regards
Bill
 
If Me.txtPassword = Me.txtConfPW Then
Docmd.SetWarnings False
Docmd.RunSQL "Update table SET Password = " & Chr(34) & Me.txtPassword & Chr(34) & _
" WHERE UserName = " & Chr(34) & Me.UserName & Chr(34) & ";"
Docmd.SetWarnings True
MsgBox "Password updated!", vbOKOnly
Me.PWReset = False
DoCmd.Close acForm, "frmPasswordChange"
Else
MsgBox "Passwords don't match, please re-enter!", vbOKOnly
Me.txtPassword.SetFocus
End If
End Sub

just replace with correct table name and field name.
 
Thank

But I got an error (Method or Date member not found, 'Username' in Me.Username is highlighted) when running the following statement:

" WHERE UserName = " & Chr(34) & Me.UserName & Chr(34) & ";"

I use the UserName field in the tbluser.

Please help.

Regards
Bill
 
what is the textbox name in your form for UserName, then modify the code with correct textbox name.
 
Thank
It works now but I found 2 issues and 1 message:
1.The text box of Confirm New Password has always a Password Input Mask (********)
2.When any user resets the password, the password of the 1st user in the tbluser got the password changed as this user
3.Sometimes, I got the message:
'Write Conflict
This record has been changed by another user since you started editing it. If you save the record. you will overwrite the change the other user made.'

Please advise how to fix.

Regards
Bill
 
1. remove the Input Mask from your Confirm New Password textbox.
2 & 3. make the form unbound.
 

Users who are viewing this thread

Back
Top Bottom