Error in Code

  • Thread starter Thread starter alfiajamel
  • Start date Start date
A

alfiajamel

Greetings...

I get the error message, "Number of query values and destination fields are
not the same" for the code below:

CurrentDb.Execute "INSERT INTO tblProjects (ProjectSupervisor) " & _
"VALUES (" & ProjectSupervisor & ") "

I am trying to imput the one value into a table.
 
Hi alfiajamel,

If ProjectSupervisor is a string variable you need to make it quoted.
Also you should make sure that any quote symbols within it are doubled up so
they do not cause problems

"VALUES (""" & Replace(ProjectSupervisor, """", """""") & """)"

Hope that helps,

Clifford Bass
 
Back
Top