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.5. Data Access with ADO

Storing and retrieving data is the reason databases are employed, and a large proportion of your programming usually revolves around manipulating those objects that deal with data: views, stored procedures, and recordsets. To do this in ADO, you need some understanding of the parts of the ADO Object Model. This section discusses using ADO methods to access data.

7.5.1. Overview of the ADO Object Model

The ADO Object Model contains five main objects: the Connection, Command, Recordset, Record, and the Stream objects. Although you've already explored some examples that use the Connection object to execute actions on a data source, that's really just the beginning of the ADO functionality. These other ADO objects provide much of the rich and powerful functionality of the ADO library.

As already mentioned, the ADO Connection object stores the information that is necessary to describe the connection to an ADO data provider. It provides several methods for working with the connection, such as opening, closing, beginning transactions, committing transactions, executing commands, and so on. In general, but not always, a connection is opened to a data source when a database solution is invoked and is used to execute commands throughout the use of the Access solution.

The ADO Command object provides an interface for you to execute actions on the ADO data source. A command statement is applied to the object's CommandText or CommandStream property and the Execute ...

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