开发者

Making reference to a VBA recordset via SQL

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜