Error in Code

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.
 
R

ruralguy via AccessMonster.com

I think Access cannot figure out what ProjectSupervisor you want. Try
renaming one of them.
 
C

Clifford Bass

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top