Search code examples
sqlms-accessvbarecordset

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?


Solution

  • 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.