DAO library references older than 3.6 are not supported in Access 2007. This means
that if you have references to older DAO versions in any older format databases you
want to work with in Access 2007, you will need to reset these references to DAO 3.6. Databases that
were created in Access 2000 format with a DAO 3.6 reference, when opened in Access 2007, still
have a reference set to the DAO 3.6 object model (as shown in Figure 5.1), and their DAO code com-
piles and runs. The same is true of Access 2002/2003 format databases opened in Access 2007.
FIGURE 5.1
A reference to the DAO 3.6 object model in an Access 2000 database opened in Access 2007.
As it turned out, the DAO object model is still supported, though with some changes. If you convert
an earlier format database to Access 2007 format, or create a new Access 2007 database, by default
it has a reference to the Microsoft Office 2007 Access database engine object model (file name:
ACCESS 2007 DAO.DLL). This new object model (which I will hereafter reference as Access 2007
DAO) has the same core functionality as DAO 3.6 (with a few differences, which are discussed in
the “New Objects in the Access 2007 DAO Object Model” section), and the same object model
abbreviation (DAO) for use in declarations, so Microsoft hasn’t really pulled DAO after all — instead,
they renamed it, added a new object and a few new attributes, and hid some of the components that
are not directly related to working with Access data.
This means that all your old DAO code will run the same as before, so you don’t need to convert it
to ADO (though of course you can, if you want to use the more modern ADO object model), and if
you are working with an Access 2007 database, you will have a few new object model components
that represent the new features in Access 2007.
The sample database for this chapter is DAO and ADO Sample Code.accdb. In addition,
some of the code references the sample database Northwind 2007.accdb, which
you can create by double-clicking the Northwind.accdt template in the C:\Program Files\
Microsoft Office\Templates\1033\Accessfolder.
NOTENOTE
NOTENOTE
Part II Writing VBA Code to Exchange Data between Office Components