Update query to insert new password into table

armesca

Registered User.
Local time
Yesterday, 19:16
Joined
Apr 1, 2011
Messages
45
I created a form that helps the user create a new password. I want to create an update query that will take the new password and overwrite it for the appropriate user in the table. Attached is what I have:

Private Sub cmd_changepass_Click()
If IsNull(Me.txt_username) Then
MsgBox " Enter your Username"
Exit Sub
Else
If (Me.txt_newpass <> Me.txt_confirmpass) Then
MsgBox "Passwords do not match"
Exit Sub
Else
End If
If Me.txt_oldPass.Value = DLookup("Password", "[User Table]", "Username = '" & txt_username & "'") Then
MsgBox "YESSS"
Else
MsgBox "Username and password do not match"
Exit Sub
Else
CurrentDb.Execute "UPDATE [User table] set Password = txt_confirmpass WHERE me.txt_username?????? "
End If
End If
End Sub


Thanks for any help
 
You need to concatenate the password textbox value (txt_confirmpass) into the string in the same manner that the user name was concatenated into the DLookup above. The WHERE clause would be exactly the same as in the DLookup.
 

Users who are viewing this thread

Back
Top Bottom