473,671 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INSERT INTO Query Error

12 New Member
I am creating a query to find unmatched rows between a local access table and an online MS SQL Server table based on the PK field ID. This is working without any flaws. My problems start when I run a append query with INSERT INTO based on the result of the former. I get the following error:

"Database set 0 field(s) to null due to a type conversion failure and it didnt add 1 record(s) to the table due to key violations, 0 record(s)due to lock violations, and 0 record(s) due to validations rule violations...."
I have enclosed an screen dump of the error

The strange thing is that query fires normally after a while!! My other append and update queries dont have this problem, I have also a append query going in the oppisite direction, from the online SQL table to the local Access table, and this error does not show up in that case.

I have two tables for the export to the online tables, one is the parent table and a child table, I see to it that the parent table gets upploaded before the child table, I do this in a macro, could it be a problem with the parent table not being able to uploaded before the child table event fires? Is it poosible to have som time delay in between? if this could be the issue?

thanks
-Sohail
Attached Images
File Type: jpg appendQueryError.jpg (7.9 KB, 199 views)
Jun 17 '10 #1
12 2662
jimatqsi
1,276 Recognized Expert Top Contributor
Why not just add a join to the parent table in your append so if the key is not in the parent table an attempt to put it in the child table cannot be made.

Jim
Jun 17 '10 #2
lupis
12 New Member
So you think the error generated could be due the parent table not getting uppdate before the child table action event fires?
Jun 17 '10 #3
NeoPa
32,569 Recognized Expert Moderator MVP
Have you checked to see which item is failing. It will either be a key that is included twice in the query, or a key that already exists in the destination table.

The SQL may be helpful too. It's hard to work blind, and the SQL is likely to be required to get an understanding of what's wrong.
Jun 17 '10 #4
lupis
12 New Member
Hi NeoPa

"It will either be a key that is included twice in the query, or a key that already exists in the destination table."

I create first a query to see what records are in the local table and not on the remote table, I then use this query as a basis for the actual INSERT INTO query for the remote table, so a PK key does not exist previously for that record. The PK is autoincremented , inexed and does not accept duplicates.

-Sohail
Jun 17 '10 #5
NeoPa
32,569 Recognized Expert Moderator MVP
That may be true, but we are not only talking of PKs here. Any index could cause this problem. In fact one has. Without question. That's what the message is telling you.
Jun 17 '10 #6
lupis
12 New Member
So this would still commmit to the local Access table and not the remote SQL Server table?
Jun 17 '10 #7
NeoPa
32,569 Recognized Expert Moderator MVP
I don't understand the question. The record that fails would go nowhere.

As I suggested in post #4 you need to determine which record is failing. From there you may find you understand why it does so and can then decide how you think it should be working and make the relevant changes.
Jun 18 '10 #8
lupis
12 New Member
@NeoPa
Well, the record does go somewhere,it is actually saved locally but not remotely, and I am just handling two records, one for the parent table, and after that the child table so it has a valid FK of the parent table.
Jun 18 '10 #9
lupis
12 New Member
@NeoPa
Well, I got it solved finally, it was not a timing issue as I suspected. I got some good advice not to include the PK in my append query, thats what was causing the problem.

-Sohail
Jun 18 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
15409
by: Annie | last post by:
hello guys, I have little experience working with C# and MS Access ... I am having an insert query with one datetime field and a boolean and couple of text and number fields as below: "Insert into order (OrderClientID, OrderDate, OrderOfferID, OrderIsSpecial, OrderShipment) Values (6, # 16/09/2005 2:38:51 PM # , 1 , 0 , 'hello there it is test')"
3
2445
by: tyngtyng | last post by:
hi... i'm new to the php and now i'm getting an error to insert my data inside the form..and also undefined index in latest_updated...... Now,i'm having trouble catching what i'm doing wrong....Here's my code to the query entry... <?php include 'config.php'; $pili_id=$_POST; $branch=$_POST;
2
4804
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and sql server is my backend server. This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
6
3450
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am using MS-Access 2000 database table for this app. Note that the datatype of all the fields mentioned above are Text. Apart from the above columns, there's another column in the DB table named 'RegDateTime' whose datatype is Date/Time which is...
2
1725
by: csharpa | last post by:
Hi, I wrote an insert query in TableAdapter and it gave me this error “Failed to get schema for this query”. The query that I wrote was this INSERT INTO STUDENT (S_ID, S_NAME, S_DOB, S_ADDRESS) VALUES (@Param1,@Param2,@Param3,@Param4) So how can I solve the error? Thank you
1
1224
by: kiny3k | last post by:
hi, i have written this insert query for inserting data in database : "insert into leavemaster (leave_code,leave_desc,leave_type, leave_days, leave_valid_month, leave_amount, effective_date, max_limit, leave_num, maintain_bal, leave_encash, leave_fq, encash_limit, encash_fq, carry_frwd, negative_bal, max_encash_bal, leave_limit, holiday_lv, weekoff_lv, del_flag" & _ "values (@leave_code, @leave_desc, @leave_type, @leave_days,...
8
9406
by: Santy | last post by:
Hello All, I am new to DB2, Currently i am using DB2 version 8.02 personal edition on Windows XP Professional. And Facing problem with rowlock in insert query. I have created a sample database as CREATE TABLE SCEMANAME.LOG ( Sequence DECIMAL(9 ,0) NOT NULL ,
1
2756
by: Luqman | last post by:
I have created a Insert Query in Sql Data Source using Oracle Database, with the parameters, and its connected with DetailView Control. When I try to Insert through DetailView Control, Illegal Variable Name/Number Error occurs. Is there any way I can trace or display on screen, what exactly the query is being passed to the Oracle with the Values. For example: If my Sql datasource has following query.
2
4811
by: kaushalgajjar | last post by:
Hi there i have a problem in inserting a query to Access database. i am having a column which is AutoNumber and if i skip that field in insert query from vb.net then it is giving me an error "Syntax error in INSERT INTO statement." Here is my coding Dim qry as string qry = "Insert into usertable (username,password,Personname) values ('" & txtUsername.Text & "','" & txtPassword.Text & "','" & txtPersonname.Text & "')" cmd.CommandText...
4
7600
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to an excel spreadsheet. There are two tables. One is a list of general contacts, and the other is a list of clubs. The clubs contain members who are within the contacts table. When I add a list of new club members from the
0
8478
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8397
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8919
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6230
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.