Using Microsoft Access with Lectora
May 4, 2007 12:00 AM
Hello FutureDeveloper. strSQL = "INSERT INTO Results(UserID,FirstName,LastName,Department) VALUES ( '" & sUserID & "', " & sFirstName & ", " & sLastName & ", " & sDepartment & ")" In looking at the above code, except for UserID all the other parameters are text. (Am I correct?)Try this code instead. strSQL = "INSERT INTO Results(UserID,FirstName,LastName,Department) VALUES ( " & sUserID & ", '" & sFirstName & "', '" & sLastName & "', '" & sDepartment & "')" Notice I put ' ' around the parameters that are text and removed it from the UserID that is numeric.Also ensure that the field size of each column is enough to take the data being inserted. I can't tell you the amount of times where I have grappled with error messages, thinking my code was wrong when in actual fact the field size was too small. Also can you tell me what was the actual error message you received? That could help for me to determine what is the problem if the above code change doesn't work.Let me hear from you what happened.
Discussions have been disabled for this post