How to: Create a DAO Recordset From a Query
Access Developer Reference |
You can create a Recordset object based on a stored select query. In the following example, Current Product List is an existing select query stored in the current database:
|
If a stored select query does not already exist, the OpenRecordset method also accepts an SQL string instead of the name of a query. The previous example can be rewritten as follows:
|
The disadvantage of this approach is that the query string must be compiled each time it runs, whereas the stored query is compiled the first time it is saved, which usually results in slightly better performance.