Question : Run time error '3464' on SQL statement due to Data Type mismatch

Run time error '3464'
Data type mismatch in crieria expression

In 1 of my sub procedures I execute the following statements which generated the error listed above
on the 2nd statement:

I diplayed the strSQLFull string in the Immediate Window to show the SQL statement that was generated:

1)strSQLFull = "UPDATE tblSecurity SET PASSWORD=" & Chr(34) & Me!txtPasswordNew & Chr(34) & " WHERE USERID= " & Chr(34) & Me!cboEmpNew.Value & Chr(34)

2) CurrentDb.Execute "UPDATE tblSecurity SET PASSWORD=" & Chr(34) & Me!txtPasswordNew & Chr(34) & " WHERE USERID= " & Chr(34) & Me!cboEmpNew.Value & Chr(34)

-----------------------------------------------------------------------------
?strSQLFull
UPDATE tblSecurity SET PASSWORD="JOHN" WHERE USERID= "1"

In a table named tblSecurity, I used the following 2 fields in the SQL statement with the accompanying data types. Do you know why I get this error message ?

fields               data type
-------------      ---------------
USERID            AutoNumber
PASSWORD      text




Answer : Run time error '3464' on SQL statement due to Data Type mismatch

Try this:

CurrentDb.Execute "UPDATE tblSecurity SET PASSWORD=" & Chr(34) & Me!txtPasswordNew & Chr(34) & " WHERE USERID= " & Me!cboEmpNew.Value
Random Solutions  
 
programming4us programming4us