Hey,
I have a form which I have used for users to login to the database. This form works well, but i also added a "change your password form".
This form has a combo box which has the user name and three other text boxs (txtOldPW, txtNewPW, txtNewPW2). It also has a change password button too (btnChangedPW).
I have also added a onclick code to the button:
Private Sub btnChangedPw_Click()
Dim PWtocompare As String
PWtocompare = DLookup("Password", "tblLogin", "[ID]=" & Me.txtLoginID.Value)
If txtOldPw = PWtocompare Then
If txtNewPw = TxtNewPw2 Then
Me.txtNewPw.SetFocus
Dim strSQL As String
strSQL = "UPDATE tblLogin SET Password = '" & Me.txtNewPw.Text & "' WHERE ID = txtLoginID"
DoCmd.RunSQL strSQL
Else
MsgBox "Passwords do not match, please re-enter your new password", vbOKOnly, "Passwords do not match"
End If
Else
MsgBox "Current password does not match records. Please enter your current password again", vbOKOnly, "Incorrect Password"
End If
End Sub
When users try change their password (successfully), a message box pops up with "You are about to update 1 row". After clicking ok, the record in the table is changed into the new record. Also note the three password textboxes have a password mask.
Heres the problems:
1. After changing the password, even though the new password has now been inputted into the table, the user can NOT login using the new password. (I suspect the problem in with the mask. If so, how do I get rid of the problem and still keep the mask)
2. How can i get rid of the error default message "you are about to update 1 row" and replace it with "Password Changed" message?
I have a form which I have used for users to login to the database. This form works well, but i also added a "change your password form".
This form has a combo box which has the user name and three other text boxs (txtOldPW, txtNewPW, txtNewPW2). It also has a change password button too (btnChangedPW).
I have also added a onclick code to the button:
Private Sub btnChangedPw_Click()
Dim PWtocompare As String
PWtocompare = DLookup("Password", "tblLogin", "[ID]=" & Me.txtLoginID.Value)
If txtOldPw = PWtocompare Then
If txtNewPw = TxtNewPw2 Then
Me.txtNewPw.SetFocus
Dim strSQL As String
strSQL = "UPDATE tblLogin SET Password = '" & Me.txtNewPw.Text & "' WHERE ID = txtLoginID"
DoCmd.RunSQL strSQL
Else
MsgBox "Passwords do not match, please re-enter your new password", vbOKOnly, "Passwords do not match"
End If
Else
MsgBox "Current password does not match records. Please enter your current password again", vbOKOnly, "Incorrect Password"
End If
End Sub
When users try change their password (successfully), a message box pops up with "You are about to update 1 row". After clicking ok, the record in the table is changed into the new record. Also note the three password textboxes have a password mask.
Heres the problems:
1. After changing the password, even though the new password has now been inputted into the table, the user can NOT login using the new password. (I suspect the problem in with the mask. If so, how do I get rid of the problem and still keep the mask)
2. How can i get rid of the error default message "you are about to update 1 row" and replace it with "Password Changed" message?