Vba删除表中的重复值 [英] Vba delete duplicated value in table

查看:115
本文介绍了Vba删除表中的重复值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我需要你的帮助来解决我的问题,如果你在这里检查我的图像,使用VBA删除我的表中的重复值有时我可能会再次添加记录但是有一次我点击按钮将删除重复数据。

感谢您的帮助

Dear All,
I need your help to solve my problem to remove the duplicated value in my table by using VBA if you check my image here is some times I may add again record but once I click on the button will remove duplicate data.
thanks for help

附图像
dup.jpg (73.9 KB,189 views)
Attached Images
dup.jpg (73.9 KB, 189 views)

推荐答案

您可以创建查找重复项查询 - 内置于Access系统中。转到创建>查询向导>查找重复项查询向导。


您必须手动删除任何重复项,因为Access无法删除重复项。记录,因为它不知道哪一个是重复的,哪一个是原始的。


但是,作为好建议,您可能想要解决如何向表中添加记录,以便您可以以编程方式防止创建重复项。这是另一个线程的问题。
You can create a "Find Duplicates" query--which is built into the Access system. Go to Create > Query Wizard > Find Duplicates Query Wizard.

You will have to manually delete any duplicates, as Access cannot "delete a duplicate" record, because it does not know which one is a duplicate and which one is the original.

However, as good advice, you may want to address how you are adding records to your table, so that you can programmatically prevent duplicates from being created. That is a question for another thread, though.


感谢您的建议,但我有一个问题是:我有时会忘记再次上传excel文件到我的数据库中,所以最好的方法是当我上传excel文件然后将数据附加到我的表后vb将删除重复的数据,希望有人可以帮我解决我的问题
thanks for your advice, but I have one problem is: I upload excel file into my DB some times I forget to upload again, so the best way is when I upload excel file then after append data into my table vb will delete duplicated data, hope someone can help me to solve my problem


再次,VBA不会删除 ;重复"数据,因为它不知道哪个是重复的,哪个是原始的。您可能会删除两者。但是,根据您的解释,您必须首先阻止上传添加重复数据。


您只能通过逐行导入数据来解决此问题和比较。但是,再一次,讨论会更适合不同的主题。
Again, VBA won''t delete "duplicate" data because it doesn''t know which is a duplicate and which is the original. You risk deleting both. However, based upon what you explain, you would have to prevent your upload from adding duplicate data in the first place.

You could only approach this by importing the data line-by-line and comparing. But, again, that discussion would be more suitable for a different thread.


这篇关于Vba删除表中的重复值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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