Direct Access Objects

DAO is the programmatic interface between VBA and Jet databases, ODBC (Open Database Connectivity) data stores, and installable ISAM (Indexed Sequential Access Method) data sources, such as Excel, Paradox, dBase, and Lotus 1-2-3.

As is described in greater detail a little later in this section, DAO supports two different data access environments, or workspaces: Microsoft Jet and ODBCDirect. You use Microsoft Jet workspaces when you need to take advantage of Jet's unique features, such as the ability to link data from different database formats.

DAO was first released as a part of Visual Basic 2.0, and was known internally at Microsoft as VT Objects, which provided a limited set of options for interacting with ODBC data sources. In November 1992, DAO 1.0 was released as part of Access 1.0. It provided Access developers with a limited set of database objects for manipulating the Microsoft Jet data engine. Improvements in DAO version 2.0 (released with Access 2.0) meant that programmers were afforded almost complete control over creating and modifying database objects, as well as manipulating data using a variety of recordset types. DAO 2.5 was created for both 16- and 32-bit platforms, and was designed for use with ODBC Desktop Database Drivers 2.0.

In 1995, Microsoft simultaneously released DAO 3.0 in both Access 95 and Visual Basic 4.0, offering full 32-bit type libraries, plus several extra properties and methods to complete the object model. In addition, the new Error object was added to provide an easier way of accessing runtime error information.

DAO is implemented so that its objects (databases, tables, fields, queries, and so on) are organized into a hierarchy of collections. A collection is simply a container for a group of objects of the same type. Each object in the hierarchy contains one or more properties that define its characteristics, and one or more methods (programs) to carry out a variety of actions against those objects. DAO enables you to use a programming language to access and manipulate data in local or remote databases, and to manage those databases, their objects, and their structures.

But because DAO was specifically designed to interface with the Jet database, it has to translate calls to ODBC when using databases other than Access, thereby resulting in slower performance. To counter this, Microsoft briefly introduced RDO (Remote Data Objects), a model that attempted to offer performance advantages over DAO when accessing remote data sources. The problem was that RDO only shipped with Visual Basic Enterprise Edition, and required a Visual Basic runtime license to use it.

DAO 3.5 was released with a new feature—ODBCDirect. The ODBCDirect workspace uses RDO in the background to provide an alternative when you only need to execute queries or stored procedures against a back-end server, such as SQL Server, or when your application needs the specific capabilities provided by ODBC, such as batch updates or asynchronous queries. ODBCDirect allows you to access database servers through ODBC, without having to load the Jet database engine. Although it is the same technology, ODBCDirect was designed to provide the remote data access functionality that DAO didn't handle.

DAO 3.6, as shipped with Access 2003, is the newest offering that has been updated to use the Jet 4.0 database engine. The only real difference between DAO 3.6 and DAO 3.5 is that all Unicode interfaces are enabled, which means that data is now supplied in Unicode. Additionally, dBase and Paradox ISAMs now require that the Borland database engine be installed, and since Jet 4.0 does not provide a Visual FoxPro ISAM, you'll need to use the Visual FoxPro ODBC Driver instead. These changes don't affect 3.5x applications, because DAO 3.5x and 3.6 can coexist on the same computer.

Was this article helpful?

0 0

Post a comment