SQL Question

The statement below inserts into a 3 field table....The first field (represented by ? below) is an AutoNumber field....When I try to run the code without refrence to the autonumber field I get an error saying "number of query values and destinaiton fields are not the same"....How can I get around this problem?

"INSERT INTO SERVICE_ASSIGNMENTS Values (?,  " & MyService & ", " & MyMix & ");"
dwood1112Asked:
Who is Participating?
 
imitchieConnect With a Mentor Commented:
"INSERT INTO SERVICE_ASSIGNMENTS (Service, MyMix) Values (" & MyService & ", " & MyMix & ");"
0
 
ChumadConnect With a Mentor Commented:
You could name out the fields:

insert into service_assignments (field1, field2, field3) values  (?,  " & MyService & ", " & MyMix & ");"

Obviously, you'd want to exclude the auto number field.
0
 
imitchieCommented:
i.e. name the fields you are actually inserting into
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.