易表在线答疑技术与交流用户社区 → 求助:两表合一问题 急!急!急!


  共有2997人关注过本帖树形打印复制链接

主题:求助:两表合一问题 急!急!急!

帅哥哟,离线,有人找我吗?
redpin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
求助:两表合一问题 急!急!急!  发帖心情 Post By:2022/11/3 8:12:00 [只看该作者]


此主题相关图片如下:微信图片_20221103080153.png
按此在新窗口浏览图片

需要把B表中与A表中相同的记录删除形成新的C表。


DelFor("C表","记录", "<>" ,"") And
AddRow("C表","x_ID,记录",[x_ID],FindText("A表","记录","x_ID", "=" ,""))


用上面公式设计成按钮有问题吗?

 

开始用上面公式似乎成功实现了目的,但再此执行后就把C表中的记录全部删除了,再怎么折腾也没结果了!

 

感谢各位大侠赐教,谢谢!


 回到顶部
帅哥哟,离线,有人找我吗?
redpin
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
  发帖心情 Post By:2022/11/3 8:27:00 [只看该作者]

不好意思,公式复制错了

 

DelFor("C表","记录", "<>" ,"") And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",2)) And

DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",3)) And

DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",4)) And

DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",5)) And

DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",6)) And

..............

 

直到把A表中符合条件的记录做完


 回到顶部
帅哥哟,离线,有人找我吗?
redpin
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
  发帖心情 Post By:2022/11/3 8:30:00 [只看该作者]

首先把B表记录添加到C表

 回到顶部
帅哥哟,离线,有人找我吗?
redpin
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
  发帖心情 Post By:2022/11/3 8:46:00 [只看该作者]

完整公式

 

DelFor("C表","记录", "<>" ,"") And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录1","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录2","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录3","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录4","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录5","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录6","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录7","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录8","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录9","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录10","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录11","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录12","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录13","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录14","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录15","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录16","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录17","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录18","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录19","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录20","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录21","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录22","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录23","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录24","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录25","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录26","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录27","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录28","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录29","x_ID", "=" ,"")) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录30","x_ID", "=" ,"")) And
DelReptRows("C表","记录") And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",2)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",3)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",4)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",5)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",6)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",7)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",8)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",9)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",10)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",11)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",12)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",13)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",14)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",15)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",16)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",17)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",18)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",19)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",20)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",21)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",22)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",23)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",24)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",25)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",26)) And
RecalcRow("C表",1,1,1)


 回到顶部
帅哥哟,离线,有人找我吗?
redpin
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
  发帖心情 Post By:2022/11/3 9:06:00 [只看该作者]

如果有几千上万的记录,这个公式又怎么写?

 回到顶部
帅哥哟,离线,有人找我吗?
redpin
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
  发帖心情 Post By:2022/11/3 9:29:00 [只看该作者]

再次把公式修改,去掉了首行的单元格公式,还是没有结果

 

DelFor("C表","记录", "<>" ,"") And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",2)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",3)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",4)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",5)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",6)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",7)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",8)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",9)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",10)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",11)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",12)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",13)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",14)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",15)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",16)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",17)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",18)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",19)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",20)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",21)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",22)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",25)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",26)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",27)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",28)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",29)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",30)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",31)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",32)) And
AddRow("C表","x_ID,记录",[x_ID],FindText("B表","记录","x_ID", "=" ,"",33)) And
DelReptRows("C表","记录") And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",2)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",3)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",4)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",5)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",6)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",7)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",8)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",9)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",10)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",11)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",12)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",13)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",14)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",15)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",16)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",17)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",18)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",19)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",20)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",21)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",22)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",23)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",24)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",25)) And
DelFor("C表","记录", "=" ,FindText("A表","记录","x_ID", "<>" ,"",26)) And
RecalcRow("C表",1,1,1)


 回到顶部
帅哥哟,离线,有人找我吗?
redpin
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:133 积分:535 威望:0 精华:0 注册:2006/8/18 12:44:00
  发帖心情 Post By:2022/11/3 10:53:00 [只看该作者]

已解决目前A、B两表记录很少的问题,是部分条件引用错误造成的,如果两表记录很多,这个公式是肯定解决不了问题的!


 回到顶部