January 2002
Beginner
576 pages
13h 23m
English
You can run queries from VBA in a number of different ways. You can run either SQL strings or queries that are already stored in your database in a variety of ways. Table 12.1 shows some common methods of running queries that are available to you.
| Action, Method, or Object | Object Runs From | Source | Example |
|---|---|---|---|
| runSQL action | DoCmd | SQL string |
docmd.runSQL strSQL |
| OpenQuery action | DoCmd | Stored query |
docmd.OpenQuery "qryTotals" |
| OpenRecordset method (DAO) | Connection or database | SQL string or stored query |
db. OpenRecordset strSQL |
| Open method (ADO) | Connection or recordset | SQL string, stored query or stored procedure |
rs.Open "SELECT * FROM Customers, cn |
| Execute method (DAO) | Connection ... |
Read now
Unlock full access