Skip to content

What's happening with DAO

Some helpful insights about the future of DAO, and what it means for you.

For several years now, there have been rumors that DAO would be dropped, so that in future only ADO could be used to work with Access data.  While doing research for my new book, I even came across a Microsoft document in which the DAO object model was described as “deprecated”, meaning that it would no longer be supported in future.  This would have been most unfortunate, because DAO was crafted from the start to work specifically with Access data, and it supports operations on Access databases that can’t be done in ADO, such as working with form recordsets, and the Tables (and subsidiary Fields) collection (or some alternate method for creating tables and their fields programmatically), and there are situations when you need these features of DAO, while working in an Access database, or creating an Access add-in.

Well, in the end, in Office 2007 Microsoft did the right thing – instead of dropping DAO, they removed a few objects that were rarely used, added a few useful new objects, and gave it a fancy new name, “Microsoft Office 2007 Access database engine object model”.

Despite the new name, which you will see in the References dialog (see Figure C), the object library name in declarations is the same (DAO), so declarations like

Dim dbs As DAO.Database

Dim rst As DAO.Recordset

 

will still work fine.


Figure A.  The References dialog in an Access 2007 database

However, 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 and Access 2002/2003 format with a DAO 3.6 reference, when opened in Access 2007, still have a reference set to the DAO 3.6 object model, and their DAO code will compile and run.

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 updated object model has the same core functionality as DAO 3.6, 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 (the Recordset2 object, used for working with the new Attachments field data type) 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, at least if you don’t need any of the features that ADO lacks), 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.

About this author