Solved

SQL Question

Posted on 2007-12-04
3
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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