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
12 2650 jimatqsi 1,271
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
So you think the error generated could be due the parent table not getting uppdate before the child table action event fires?
NeoPa 32,557
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.
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
NeoPa 32,557
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.
So this would still commmit to the local Access table and not the remote SQL Server table?
NeoPa 32,557
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.
@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.
@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
NeoPa 32,557
Recognized Expert Moderator MVP
I'm pleased you resolved your problem. Obviously that would have been hard for anyone here to know in the absence of the SQL I suggested you showed in my post #4. Frankly, if that's the issue then I'm surprised you got any records to add at all, but it's hard to know what's really going on from a distance, without the information to work from.
jimatqsi 1,271
Recognized Expert Top Contributor
Yes, sounds like the PK is an auto-incrementing numeric, otherwise leaving it out of the append would fail completely. But I didn't realize you could specify that value sometimes.
Jim
NeoPa 32,557
Recognized Expert Moderator MVP
I'm pretty sure you can't Jim. Sometimes we don't get all the information posted, for various reasons.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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:
...
|
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...
|
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...
|
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...
|
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,...
| |
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,...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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,...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |