Solved

SQL Question

Posted on 2007-12-04
3
238 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

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…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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