I have this login form and when I add a new user to the DB, I set the password to temporary. When the password is "temporary" then a new form opens up asking the user if he wants to change password. When user clicks on "yes", then he is taken to another form where he has to enter "new password" and also "confirm new password". So far so good!
I have a button called "Change password" and when user clicks on it, the password is supposed to be updated in the DB. This is where I am facing an error. The code for onClick of the change password button is below:
Private Sub cmdChangePassword_Click()
If Me.txtnewPwd.Value = Me.txtConfirmPwd.Value Then
DoCmd.RunSQL "Update Login set strEmpPassword = Me.txtnewPwd.Value where strEmpPassword = " & strMyPassword & " And lngEmpID = " & lngMyEmpID & ""
MsgBox "Password successfully changed!", vbOKOnly, "Password change"
DoCmd.Close acForm, "F_ChangePasswordYes", acSaveNo
DoCmd.SelectObject acTable, , True
DoCmd.OpenForm "F_Products"
Else
MsgBox "Passwords do not match", vbOKOnly, "Password error"
End If
End Sub
I have declared strMyPassword and lngMyEmpID as global variables.
The problem is when I click on change, I get 2 MsgBoxes asking me to "enter parameter value" (Please check the attached file)
and then I get the confirmation msg saying "you are about to update 0 row(s)". (Please check the attached file - confirm.jpeg)
I know there is some error in my update query cos my password value is not changed.
And even if everything was peachy with my update query, will I still get the confirmation saying ""you are about to update 1 row(s)" ?? Is there anyway to not get that???