更新重复记录(vba) [英] Update duplicate record (vba)

查看:60
本文介绍了更新重复记录(vba)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在寻找重复记录的帮助。我有一个每天更新的表,但每天相同的记录可以显示在表上创建一个副本。


在桌子上我有一个加载日期字段,所以我可以告诉哪条记录是旧的还是新的。我想要做的是将信息从新记录转移到保留原始加载日期的旧记录,然后删除新的重复记录。我写了一些代码可以删除重复没有问题,但我无法编辑旧记录。我可以使用静态数据,但无法查看表数据。


任何帮助将不胜感激。


提前谢谢,


Slen


这是我到目前为止所拥有的/>

Hello all,

Im looking for some help with duplicate records. I have a table that gets updated on a daily basis but each day the same record could show up on the table creating a duplicate.

On the table i have a load date field so i can tell which record is old and new. What im trying to do is carry over the info from the new record to the old one keeping the original load date and then delete the new duplicated record. I have writen some code that can remove the duplicates with no problem but i am having trouble getting it to edit the old record. I can get it to work with static data but having trouble getting it to look at the table data.

any help would be greatly appreciated.

thanks in advance,

Slen

here is what i have so far

展开 | 选择 | Wrap | 行号

推荐答案

这完全是空中代码且未经测试。

This is totally air code and untested.

展开 | 选择 | Wrap | 行号


您应该做的是将新数据加载到另一个表中。运行查询以更新重复项。然后运行另一个查询以插入不在主表中的那些。
What you should do is load the new data into another table. Run a query to update the duplicates. Then run another query to insert the ones not in the main table.


你好Seth,


你太棒了!非常感谢您的回复和帮助!这很棒!


现在我只需要调整它来删除原始文件。我看到你在哪里有行rstShippers.Delete,但我删除了它,因为我因为没有被声明而收到错误。有没有办法创建两个书签一个旧的和新的然后删除旧的或delcare旧旧的OldValue然后删除它?


再次感谢!!
Hi Seth,

You are amazing! Thank you very much for your reply and help! That worked great!

Now i just need to adjust this to delete the original. I saw where you had the line rstShippers.Delete but i removed it because i was getting an error due to it not being declared. Is there a way to create two bookmarks one for old and new then delete the old or delcare the old as OldValue then remove it?


Thanks again!!


这篇关于更新重复记录(vba)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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