Hello all! I am not new to access, but new to coding (and posting). I have a database that I have created and need some help with a login form. When a user opens the database, a form pops up asking for a username and password. They can choose their name from a combobox and enter apassword into a textbox.
If the default password is entered, another forms pops up asking the user to change their password (this is where my problem comes in):
The first textbox on the Change Password form asks the user to enter a new password and the second textbox asks the user to enter the password in again to confirm it. If the information entered in both textboxes are equal, I would like to use a RunSql to update the table that holds the password information The code I am using is as follows:
I am getting a run-time error stating that there is a syntax error (missing operator) in query expression. I am using Access 2007. Please help!
If the default password is entered, another forms pops up asking the user to change their password (this is where my problem comes in):
The first textbox on the Change Password form asks the user to enter a new password and the second textbox asks the user to enter the password in again to confirm it. If the information entered in both textboxes are equal, I would like to use a RunSql to update the table that holds the password information The code I am using is as follows:
Code:
Private Sub cmdSubmit_Click()
Dim strSQL As String
If txtNewPswd <> txtConfirmPswd Then
MsgBox "Passwords don't match. Please try again.", vbOKOnly
Else
If txtNewPswd = txtConfirmPswd Then
strSQL = " UPDATE tblUserDefinitions"
strSQL = strSQL & " SET Password = ' " & Me.txtConfirmPswd
strSQL = strSQL & " 'WHERE lngEmpID = '" & Me.txtlngEmpID & "';"
DoCmd.RunSQL strSQL
MsgBox "Password change successful!", vbOKOnly
DoCmd.OpenForm "frmLogon"
DoCmd.Close acForm, "frmPWChng", acSaveNo
End If
End If
End Sub
Comment