没有重复时运行时错误3022 [英] Run Time Error 3022 when there are no duplicates

查看:117
本文介绍了没有重复时运行时错误3022的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这个一直困扰我一段时间,我找不到解决方案来解决这个问题。


错误信息是:


运行时错误''3022'':


您向表格请求的更改是不成功,因为它们会在索引,主键或关系中创建重复值。更改包含重复数据的字段或字段中的数据,删除索引或重新定义索引以允许重复输入并重试。


发生这种情况:


我有一个带有BLOB文件上传部分的表单。代码是:

Hi,

This one has been bugging me for a while, and I can''t find a solution to get round it.

The error message is:

Run-time error ''3022'':

The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.


Where this occurs:

I have a form with a BLOB file upload section. The code for this is:

展开 | 选择 | Wrap | 行号

推荐答案

要添加的另一件事:


有问题的表只包含一个没有重复索引的字段 - 它是ID字段,它是一个自动编号字段。我检查了所有其他字段,但没有一个限制重复信息。
Another thing to add:

The table in question contains only one field that is indexed with no duplicates - it is the ID field which is an AutoNumber field. I have checked all the other fields, and none of them restrict duplicate information.


我看到唯一明显的问题是 rst.AddNew 行与 rst.Update 行不在代码的相同条件级别内。当然不是你需要更多。
The only obvious problem I see is that the rst.AddNew line is not within the same conditional level of the code as the rst.Update line. Not that you need more than that of course.


感谢NeoPa的回应。不幸的是,更改rst.Update行以使其落在相同的条件级别上并没有改变任何东西。


现在我能解决问题的唯一方法就是放On Error Resume Next。不是我想做的事情,因为它就像在地毯下刷污垢一样,但是当我有更多的时间时,我必须这样做并回到它。
Thanks for the response NeoPa. Unfortunately, changing the rst.Update line so that it falls on the same conditional level doesn''t change anything.

Right now the only way I can get round the problem is to put an On Error Resume Next. Not something I wanted to do, as it''s like brushing the dirt under the rug, but I''ll have to do that and come back to it when I have more time.


这篇关于没有重复时运行时错误3022的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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