如何覆盖验证规则? [英] How to override validation rules?

查看:63
本文介绍了如何覆盖验证规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access 2003中创建了一个数据库,我希望你能帮我解决一个问题。


在我的表[Log]中,我有名字,中间名和姓的字段。我的主键是自动编号,但我有几个名字看起来完全一样。有些条目是重复的,但不是全部。我是否可以创建一个验证规则来检查三个字段组合中的唯一值?此外,我希望我的验证文本显示为重复条目。继续]?;所以,如果是两个不同的人,我们仍然可以输入数据。我知道可以覆盖宏中的验证规则,但我不知道该怎么做。我也尝试过使用Dlookup功能但我已经在我的桌子上输入了超过9000名申请人,然后才意识到我的错误,我目前正在纠正。


感谢您的时间,任何建议都将是非常感谢!

I am creating a data base in access 2003 and I was hoping you could help me out with a question I have.

In my table [Log] I have fields for first name, middle initial, and last name. My primary key is an autonumber, but I have several names that appear exactly the same. Some of the entries are duplicates but not all them. Can I create a validation rule that checks for unique values in the combination of the three fields? Also I wanted my validation text to read "Duplicate entry. Continue?" so that if it is two different people we can still enter the data. I know it is possible to override validation rules in a macro but I''m not sure how to do it. I also tried using the Dlookup function but I had already entered over 9000 applicants into my table before realizing my mistake, which I am currently correcting.

Thanks for your time, any suggestions will be greatly appreciated!

推荐答案

您是直接将数据输入表格还是通过表格?
Are you entering the data directly into the table or via a form?


  1. 在表单的BeforeUpdate()事件中,根据名字,姓氏和MI检查重复。
  2. 如果组合中存在重复在这3个字段中,查看用户是否还想保存记录。
  3. 如果用户不想输入复制,请取消表格的更新(保存记录)。
  4. 在下面,找到说明这些要点的演示代码。根据字段名称,表名等进行自己的更改。
  1. In the BeforeUpdate() Event of the Form, check for duplication based on the First Name, Last Name, and MI.
  2. If Duplication exists on the combination of those 3 Fields, see if the User wants to Save the Record anyway.
  3. If the User does not wish to enter the Duplicate, Cancel the Updating (Save Record) of the Form.
  4. Below, find Demo Code which illustrates these points. Make your own changes based on Field Names, Table Name, etc.
展开 | 选择 | Wrap | 行号


ADezii的方法适用于您(通常情况下),但你需要稍微扩展一下。


这个方法可以让你知道是否存在相同的名字。但是,由于您出现了有效的重复名称,因此您需要一些功能,以便您可以决定当前条目是否实际上与当前驻留在表中的条目重复。
ADezii''s method will work for you (as is the usual case), but you''ll need to expand on it a bit.

This method will get you to the point in which you can tell whether the same name exists or not. But since you have occurrences of duplicate names that are valid, you''ll need some functionality that allows you to decide whether your current entry is actually a duplicate of the one(s) that currently reside in your table.


这篇关于如何覆盖验证规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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