通过 SQL 引用 VBA 记录集

发布于 2024-10-22 06:48:01 字数 125 浏览 5 评论 0原文

我想通过 SQL FROM 语句引用记录集。例子。

我有一个名为 RS 的记录集。我想做的是下面的VBA。

SELECT * FROM RS

有办法吗?

I'd like to make a reference to a recordset via SQL FROM statement. Example.

I have a Recordset called RS. What I want to do is the following, in VBA.

SELECT * FROM RS

Is there a way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多情出卖 2024-10-29 06:48:01

一般来说,没有。它们是两种不同的语言和环境。为了使用其中一个的信息,您必须使用 VBA 将数据发送到 SQL 进行处理,或者从 SQL 中提取数据以供 VBA 进行处理。如果您想使用 SQL 来处理此问题,有多种解决方案,其中最简单的就是使用记录集的内容填充数据库中的表,然后在查询中使用该表。

In general, no. They are two different languages and environments. In order to use information from one in the other, you either have to use VBA to send data to SQL to process or extract data from SQL to be used by VBA to process. If you wanted to process this using SQL, there are numerous solutions the simplest of which is to populate a table in the database with the contents of your recordset and then use that table in your query.

吾家有女初长成 2024-10-29 06:48:01

您有什么类型的记录集,DAO 还是 ADO?

如果您有填充的 ADO 记录集,并且只需要它的子集,则可以使用 RS.Find 查找符合特定条件的单行,或RS.Filter 过滤掉不符合特定条件的每一行。
请注意,这仅适用于 ADO 记录集,不适用于 DAO 记录集!

它不完全是“从 RS 选择 *”,但也许它对您有帮助。

What kind of recordset do you have, DAO or ADO?

If you have a populated ADO recordset and you need only a subset of it, you can use RS.Find to find single rows which match a certain criteria, or RS.Filter to filter out every row which doesn't match a certain criteria.
Be aware that this only works with ADO recordsets, not DAO recordsets!

It' not exactly "Select * from RS", but maybe it helps you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文