Parameter help

csdrex87

Registered User.
Local time
Today, 13:40
Joined
Jul 1, 2009
Messages
66
This might be an easy question it might not be. I'm having another problem with my code and either my eyes are goin crazy or i just dont see where the problem is. Anyway my code is basically supposed to take the password and put it into the system along with the generic user security level (intgenUSL) as well as put it into the UserLevelAccess form. The problem im getting is when i try to store the information in the tbl as well. I get a "error:3061 ... Too few parameters: Expected 1"

This is the segment of code that is being executed

If IsNull(strPWD = DLookup("[Emp_Password]", "tblEmployeeInformation", "[Emp_Lname]='" & Me.txtUser & "'")) Then

DoCmd.OpenForm "formUserLoginAccess", acNormal

intgenUSL = 3
Forms!formUserLoginAccess.txtUSL = intgenUSL

If MsgBox("Are you sure you want to create your password?" & vbCrLf & _
"Please write down your current password in a safe place", vbQuestion + vbYesNo, "Cancel Confirmation") = vbYes Then


CurrentDb.Execute "UPDATE tblEmployeeInformation SET " & " Emp_Password= '" & Forms!formUserLogin!txtPWD & "' WHERE [Emp_Lname] = " & Chr(34) & Me.txtUser & Chr(34)

CurrentDb.Execute "UPDATE tblEmployeeInformation SET " & " Emp_UserLevelAccess= '" & Forms!formUserLoginAccess!txtUSL & "' WHERE [Emp_Lname] = " & Chr(34) & Me.txtUser & Chr(34)

End If
 
Within a string you may use ' or " to wrap text literals, but but not both!

You need to be consistent:

Try:

Code:
CurrentDb.Execute "UPDATE tblEmployeeInformation SET Emp_Password= """ & Replace(Forms!formUserLogin!txtPWD, Chr(34), Chr(34) & Chr(34)) & """ WHERE [Emp_Lname] = """ & Me.txtUser & """"


I added the Replace() on the Password just in case someone tries to use " in their password.
 
While you didnt directly help me you move me in the right direction. The problem i was having was i was trying to access a table cell that wasnt there!

Although I will implement that replace on my password! So thank you for that too :)
 

Users who are viewing this thread

Back
Top Bottom