获取错误3022应用过滤器时重复密钥数据。 [英] Geting error 3022 Duplicate Key data when applying a filter.

查看:108
本文介绍了获取错误3022应用过滤器时重复密钥数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,当应用过滤器,而不是更改或添加信息到我的数据库时,我得到3022错误。


这里是违规代码。

For some reason when applyinf a filter, not changeing or adding information to my database i get a 3022 error.

here is the offending code.

展开 | 选择 | Wrap | 行号

推荐答案

您好,欢迎来到 Bytes


我已经阅读了你的代码,看起来很好(也就是说,你应该用一个合理的名称命名你的命令按钮和列表框,想象一下,如果它是你继承自的数据库其他人,不得不做出代码的正面和反面)


首先想到的是,

1)你有附加的代码吗?到表单的OnFilter事件?

2)添加过滤器会导致您的记录更新吗? (例如,运行表单BeforeUpdate事件)

3)获取代码时f的值是多少?
Hi and welcome to Bytes.

I have read through your code and it seems fine (That said, You should really name your command buttons and listbox with a sensible name, imagine if it was a database you had inherited from someone else and had to make heads and tails of that code)

The first thing that pops to mind is,
1) Do you have any code attached to the OnFilter event of the form?
2) Does adding the filter cause your record to update? (Is the forms BeforeUpdate event run for example)
3) What is the value of f when you get the code?


首先,当然是Access的许多怪癖之一是它并不总是抛出实际反映错误的错误消息!


我想知道问题是否可能是

f =" Container =" &安培; List6.Value


例如,如果List6.Value为99,则上面的行会生成实际读取的过滤器

f =" Container = 99"


,因为等号后面没有空格,当这样的内容放在双引号内时,Access不会不要自动为你放置空间,就像你只需要线一样

容器= 99


没有报价。


尝试更换

f =" Container =" &安培; List6.Value




f =" Container =" &安培; List6.Value


看看会发生什么。


Linq ; 0)>
First off, of course, is that one of Access'' many quirks is that it doesn''t always throw error messages that actually reflect the error being committed!

I wonder if the problem could be

f = "Container =" & List6.Value

If, for example, List6.Value is 99, the above line would generate a filter that actually reads

f = "Container =99"

because you do not have a space after the equal sign, and when something like this is placed within double quotes, Access doesn''t automatically place the space for you, as it would if you simply had the line

Container =99

without the quotes.

Try replacing

f = "Container =" & List6.Value

with

f = "Container = " & List6.Value

and see what happens.

Linq ;0)>


Nope尝试了许多间距的排列,甚至尝试过:

Nope tried many permutations of spacing, even tried:

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


这篇关于获取错误3022应用过滤器时重复密钥数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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