O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 LibraryCollectionDefault MemberExample
ADODBCommandParameterscmd(0)
 RecordFieldsrcADO(0)
 RecordsetFieldsrsADO(0)
ADOXCatalogTablescat(0)
 TableColumnscat.tables(0)(0)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required