 |
| Access VBA Discuss using VBA for Access programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 29th, 2006, 07:55 AM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Append Query not appending
Good Morning guys,
Hope all you Americans are enjoying your Memorial Day..
Well anyway my problem that's arised is the following.
I'm using Access 2003, and with my append query I'm writing it's not exactly appending.
What I'm doing is taking information from a table called Service Hours, and trying to append it to a linked table with the exact same information in it. So I know it's got nothing to do with the information on either table not matching up.
This is the SQL statement I have for the table.
INSERT INTO [Service Hours2] ( ServiceRecordID, EmployeeID, [Date], [Travel Start], [Plant In], [Plant Out], [Travel End] )
SELECT [Service Hours].ServiceRecordID, [Service Hours].EmployeeID, [Service Hours].Date, [Service Hours].[Travel Start], [Service Hours].[Plant In], [Service Hours].[Plant Out], [Service Hours].[Travel End]
FROM [Service Hours]
And what it says is..
It cannot append all the records it's set 0 field(s) to Null due to a type conversion failure and didn't add 1 record(s) to the table due to key violations, 0 record(s) due to lock violations and 0 record(s) due to validation rule violations.
Now before ya ask..yes all the data types are the same, there shouldn't be any difference between any of the information. None of the records I'm trying to append are autonumbers or a Primary Key so I don't understand where exactly things are going wrong. So if anyone can help out that'd be great.
Thanks in advance.
|
|

May 29th, 2006, 02:39 PM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Guess I should also add that we're trying to do it so that when you update you're only putting in the newest piece of data..
|
|

May 30th, 2006, 06:47 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
I'll start with the obvious:
Are any of the fields in the reciving table autonumber? It appears not.
Are they then number fields receiving the ID fields from the other table?
It sounds like you have only 1 record that is causing you problems here. Are is your test just with one record?
I would look for that one record that is causing problems. It sounds like you have created relationships off of this appended to table to the other tables (which is really necessary except for data integrity) and that it is one of those relationships causing problems. Try removing referential integrity from one of the relationships at a time, and that will narrow down the column causing trouble.
It sounds like a little detective work finding the abberant record. The append query seems to be working but for that one record.
Does this help?
mmcdonal
|
|

May 30th, 2006, 07:40 AM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hopefully I'll give it a try and post if it works.
|
|

May 30th, 2006, 07:55 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Sorry I fat fingered this thing.
"Are is your test just with one record?" = Is your test with just one record?
"(which is really necessary except for data integrity)" = (which is NOT really necessary except for data integrity) But that is not true here since you can create integrity with your follow up queries.
mmcdonal
|
|

May 30th, 2006, 07:59 AM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
well I'm testing with 1-3 records..
removed the referential integrity from the tables, and still getting the same error..
all the data being passed is the same data that is in the other table so I know it's nothing on that end.
|
|

May 30th, 2006, 08:26 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Well according to the error message, there is only one record that is offensive. Make sure there is no duplicate data in the key columns? Also, compare the table designs side by side to make sure you didn't miss anything.
mmcdonal
|
|

May 30th, 2006, 08:33 AM
|
|
Authorized User
|
|
Join Date: May 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Got it...
just had to remove a relationship to a different table..
thanks for the idea involving relationships seems that was the key there to getting this to work :)
|
|

October 10th, 2006, 01:16 PM
|
|
Authorized User
|
|
Join Date: Oct 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
deffinately something to do with relationships.
i got rid of enforce integrity and it saves now
but that makes me have to manually delete all the records instead of using integrity's delete
:(
I was here but now I'm gone.
I leave this messege to be carried on.
Whoever knew me, knew me well.
Whoever didn't, go to hell.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Append Query |
bright_mulenga |
Access |
1 |
January 3rd, 2007 01:33 PM |
| Append Query |
Cybersurfer |
Access |
1 |
February 13th, 2006 01:02 PM |
| append query? |
bph |
Access |
2 |
November 23rd, 2004 12:44 PM |
| append query |
stoneman |
Access |
2 |
November 12th, 2003 09:17 PM |
| Append query problem |
vladimir |
Access VBA |
4 |
July 23rd, 2003 07:58 PM |
|
 |