Chapter 5. Working with Access Data

IN THIS CHAPTER

  • Using the old and new DAO object models to work with Access data

  • Working with Access databases in formats from 2000 to 2007

  • Using the ADO object model to work with Access data

  • Converting DAO code to ADO code

In older versions of Microsoft Office, there were two choices for working with data stored in Access tables. One was the Data Access Objects (DAO) object model, which was developed specifically to work with Access data in recordsets (including form recordsets) and to work with table structure using the Tables (and subsidiary Fields) collections. Because of these customized features, DAO was the best object model for working with Access data.

The other choice for working with Access data was (and is) the ADO object model, introduced with Visual Studio 97, and available for use in Office 2000 and up. This object model is intended for working with data in a wide variety of sources, including Access databases. Although it lacks some of the customized features that make DAO so well suited to Access data, ADO code works fine for basic data manipulation, where you don't need to work with Access form recordsets or create tables and fields (in other words, you are just working with data in Access tables, not with their structure).

Before the release of Office 2007, word was out that Microsoft was dropping support for the DAO object model (and indeed you can see statements to this effect in various online Microsoft documents). I wondered whether ...

Get Access™ 2007 VBA Bible: For Data-Centric Microsoft® Office Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.