I'm trying to create a form that allows user to change their passwords, however the form doesn't seem to do anything other than give me the msg boxes where am I going wrong?
The code I'm using is
Private Sub btnUpdatepassword_Click()
If Me.txtPassword.Value = DLookup("Password", "tblStaff", "[UserName]= """ & Me.txtUserName & """") Then
GoTo Line1:
Else: MsgBox ("Password Is Incorrect")
End If
Line1:
If (Me.txtNewPassword1 = Me.txtNewPassword1) Then
CurrentDb.Execute "UPDATE tblStaff " _
& "Set Password = 'Me.txtNewPassword1'" _
& "Where UserName = 'Me.txtUserName';"
MsgBox ("Your password has now been updated")
Else
MsgBox "New password does not match"
End If
End Sub
The code I'm using is
Private Sub btnUpdatepassword_Click()
If Me.txtPassword.Value = DLookup("Password", "tblStaff", "[UserName]= """ & Me.txtUserName & """") Then
GoTo Line1:
Else: MsgBox ("Password Is Incorrect")
End If
Line1:
If (Me.txtNewPassword1 = Me.txtNewPassword1) Then
CurrentDb.Execute "UPDATE tblStaff " _
& "Set Password = 'Me.txtNewPassword1'" _
& "Where UserName = 'Me.txtUserName';"
MsgBox ("Your password has now been updated")
Else
MsgBox "New password does not match"
End If
End Sub