Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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
 
Old April 3rd, 2006, 10:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default Append Query Error Message Misleading

I have a backend table that is appended to an empty front end local copy of table (same structure) in the database. The reason is to allow the user to use data from the back end located on the network at a local level to speed them up (it's painfully slow otherwise because users are scattered across the state).

In Access XP (2002), I'm getting a key violation error message when the query that imports the data to the local table runs. The local table is completely empty, so I don't know why there would be a problem. The only indexed field that is set to Indexed (No Duplicates, autonumber) is lngRecNo. However, my query does not try to put data into that field; it only tries to populate the other fields in that table. The table does have a foreign key set to Indexed (Duplicates OK).

Can anyone think of why the key violation would happen? Thanks in advance for your help.
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
 
Old April 3rd, 2006, 11:47 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

"my query does not try to put data into that field" ...

If the field is there in the empty table, and you are NOT trying to put data into it, then remove it.

Alternatively, if the user is not updating data in the local table (since it is an import,) leave the field in the empty table but change it to number or text instead of autonumber.

If you try to add records to a table with an emptry autonumber field, you will get this error.

Am I on the right track here?

HTH


mmcdonal
 
Old April 3rd, 2006, 12:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:If the field is there in the empty table, and you are NOT trying to put data into it, then remove it.
The error persisted. D'oh!

Quote:
quote:Alternatively, if the user is not updating data in the local table (since it is an import,)
Actually, yes, the user is updating the data and then it's exported replacing the network data.

Quote:
quote:leave the field in the empty table but change it to number or text instead of autonumber.
Initially, I tried that and it didn't work either.

What did finally work was to make the query a MAKE TABLE query where the local table was created from scratch (hence eliminating the autonumber field as in your first suggestion). It would error out as an APPEND QUERY.

Quote:
quote:If you try to add records to a table with an emptry autonumber field, you will get this error.
Because the field is autonumber, wouldn't it always populate itself in an append query and, therefore, this would never be an issue?

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Update query (error message) Neal SQL Server 2000 1 August 3rd, 2007 08:57 PM
Append Query Cybersurfer Access 1 February 13th, 2006 01:02 PM
append query? bph Access 2 November 23rd, 2004 12:44 PM
Query String Too Long....Max Length Error Message phungleon Classic ASP Databases 14 May 28th, 2004 12:25 PM
append query stoneman Access 2 November 12th, 2003 09:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.