Solved

SQL Question

Posted on 2007-12-04
3
234 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
Comment Utility
"INSERT INTO SERVICE_ASSIGNMENTS (Service, MyMix) Values (" & MyService & ", " & MyMix & ");"
0
 
LVL 8

Assisted Solution

by:Chumad
Chumad earned 250 total points
Comment Utility
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
Comment Utility
i.e. name the fields you are actually inserting into
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now