追加查询密钥违规 [英] Append query key violation

查看:65
本文介绍了追加查询密钥违规的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用追加查询将记录从一个表移动到另一个表。两个表都没有通过任何关系连接。附加的所有字段都具有匹配的数据类型。没有字段设置为必需,所有允许零长度。两个表都具有自动编号主键,但追加查询不包含其中任何一个。如果我将表设置为附加主键索引对于否,附加查询有效,但新记录给出了重复的主键。如果我设置索引到是(没有重复)我收到密钥违规消息,查询无效。看起来该记录试图在移动时保持其自动编号。我已经找到了答案,但我被困住了,我的大脑很疼。


如果有人可以提供帮助我会非常感激。


谢谢

解决方案

< blockquote>您可能想澄清如何定义主键。根据定义,主键不能重复。在Access中,当您设置字段主键时,它将自动设置为Index,No Duplicate。

也许您应该发布表结构和查询语句的一些细节。


我猜这可能与一个问题有关Sue你曾经帮助过早期的Mario(为什么Access在添加记录时尝试重新使用自动编号?)。


我复制了表,并根据NeoPa发布的链接重命名了破坏的表。该副本似乎有效?到现在为止还挺好。感谢你的帮助,如果再次失败,我会重新发布。 :)

I am trying to move records from one table to another using an append query. Neither table is connected via any relationship. All fields being appended have matching data types. No field is set to required, all allow zero length. Both tables have autonumber primary keys but the append query does not include either of them. If I set the table to be appended primary key "indexed" to "no", the append query works but the new record gives a duplicated primary key. If I set "indexed" to "yes(No Duplicates)" I get a key violation message and the query doesn''t work. It appears that the record is trying to keep its autonumber when it moves over. I''ve searched for an answer but I am stuck and my brain hurts.

If anyone could help I would greatly appreciate it.

Thanks

解决方案

You might want to clarify how you define primary key. By definition, a primary key cannot be duplicated. In Access, when you set a field primary key, it will be automatically set to Index, No Duplicate.
Maybe you should post some details of your table structure and query statement.


I''m guessing this may be linked to a problem Sue was having that you helped with earlier Mario (Why is Access trying to re-use an AutoNumber when I add a record?).


I copied the table and renamed the broken one as per the link NeoPa posted. The copy appears to work? So far so good. Thanks for all your help I will re-post if it falls over again. :)


这篇关于追加查询密钥违规的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆