Access™ 2007 VBA Programmer's Reference
by Teresa Hennig, Rob Cooper, Geoffrey Griffith, Armen Stein
7.2. Referring to ADO Objects
When you refer to ADO objects, you do so in the same way you would using DAO. The difference is that ADO does not have a native data connection like DAO in ACCDB and MDB databases.
Recall that in DAO you can use the DBEngine(0)(0) object or the CurrentDb() function to return a reference to the current database. ADO does not have a current database. In fact, it doesn't know anything about datasets in the data source; it only knows about data source through the provider. In ADO, you must always implement a connection to an external data store through a provider before any actions can be executed for the data.
As in DAO, an object's parent collection can have a default member to which you can refer. The following table lists the default members for those ADO objects that have them.
| Object Library | Collection | Default Member | Example |
|---|---|---|---|
| ADODB | Command | Parameters | cmd(0) |
| Record | Fields | rcADO(0) | |
| Recordset | Fields | rsADO(0) | |
| ADOX | Catalog | Tables | cat(0) |
| Table | Columns | cat.tables(0)(0) |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access