Solved

SQL Question

Posted on 2007-12-04
3
237 Views
Last Modified: 2010-03-20
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 & ");"
0
Comment
Question by:dwood1112
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
imitchie earned 250 total points
ID: 20407314
"INSERT INTO SERVICE_ASSIGNMENTS (Service, MyMix) Values (" & MyService & ", " & MyMix & ");"
0
 
LVL 8

Assisted Solution

by:Chumad
Chumad earned 250 total points
ID: 20407315
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
 
LVL 25

Expert Comment

by:imitchie
ID: 20407316
i.e. name the fields you are actually inserting into
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question