从记录中读取值并生成IN STATEMENT [英] Read values from a record and make an IN STATEMENT

查看:55
本文介绍了从记录中读取值并生成IN STATEMENT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要一些帮助。我有一张名为CPM的表格。其中包含一个名为ACTNUM的字段。我正在尝试编写一个代码,将每条记录循环到In语句中。最终输出将是...('''ABCDE'',''FGHIKD'',''ZADET'')。 In语句将插入到DoCmd.RunSQL中。任何帮助将不胜感激。

解决方案

欢迎来到Bytes,cberos!


我已经阅读了你的帖子时间,但我不确定我完全明白你想做什么。如果你说ACTNUM字段有记录ABCDE,FGHIKD和ZADET,并且你想要用它们创建一个字符串,那么这很简单。请详细解释一下,并举例说明开始记录以及您的预期结果。谢谢。


cberos,


如果您只是使用该表中的所有值,您可以使用JOIN之间的JOIN获得相同的结果两张桌子。也许我错过了什么?


感谢您的回复,但这里有更多信息,也许您可​​以提供帮助。我能够遍历记录,但如果IN STATEMENT太大,则会遇到问题。该查询已被终止,因此我需要以50个为一组发送它们。查看下面的代码,我有超过1,000个出价编号,需要查看哪些客户附加到这些出价。我们的系统不允许直接加入。我要么上传到系统(需要时间),要么将出价数作为IN STATEMENT(大小有限)。我需要帮助开发一个循环,我可以获取50个记录,将它们放入IN STATEMENT,执行查询,并重复该过程直到所有出价都被处理。

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Need some help. I have a table called "CPM" which contains one field called "ACTNUM". I''m trying to write a code that will loop through each record into an In Statement. Final out put would be... In (''ABCDE'',''FGHIKD'',''ZADET''). The In Statement would be inserted to a DoCmd.RunSQL. Any help would be appreciated.

解决方案

Welcome to Bytes, cberos!

I''ve read your post a few times, but am not sure I fully understand what you''re trying to do. If you are saying that the ACTNUM filed has records ABCDE, FGHIKD, and ZADET and you want to create a string with them all, then that''s simple enough. Please explain in a little more detail and give an example of starting records and what your expected outcome is. Thank you.


cberos,

If you are simply using all the values in that table, you coul achieve the same results using a JOIN between the two tables. perhaps I am missing something?


Thanks for the responses but here''s a little more info and maybe you can help. I was able to loop through the records but ran into problems if the IN STATEMENT got too big. The query was killed so i need to send them in groups of 50. Looking a the code below, i have over 1,000 bid numbers and need to see what customer(s) are attached to those bids. Our system does not allow direct JOIN. I either upload to the system (takes time) or have the bid num as an IN STATEMENT (limited in size). I need help in developing a loop where i can fetch 50 recoreds, put them in an IN STATEMENT, execute a query, and repeat that process till all bids are processed.

Expand|Select|Wrap|Line Numbers


这篇关于从记录中读取值并生成IN STATEMENT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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