Is it better to use ADO or DAO in Access 2007?

[For the record, the official name for what once was ‘Jet’ is now the ‘Access database engine’.]

For ACE (the Access2007 engine .accdb format) features it has to be ACEDAO.

For Jet 4.0 features it has to be ADO classic.

For Jet 3.51 features and earlier, pick either ADO or DAO. There are advantages and disadvantages to both. The vast majority of Access database engine functionality is common to both; the mutually exclusive functionality is arguable fringe. A lifestyle choice, perhaps, but no big deal. The smart coder uses the best of both 🙂

I’ve used both quite a bit and ADO is my personal preference. It is more modern than DAO, so architecturally it is an improvement: flatter object model, none of the tear down problems of DAO, etc. More properties and methods and introduces events (DAO has none) e.g. for asynchronous connection and fetching of records. ADO recordsets can be disconnected, hierarchical and fabricated, DAO recordsets cannot. Basically, they took the good things about DAO and made them better.

DAO is not without its strong points. For one, you will find more DAO code examples than ADO for Access/Jet.

P.S. for some reason, folk who like DAO really dislike ADO. Ignore the propaganda. ADO isn’t deprecated. The ACE has an OLE DB provider and is currently the only way of using ACE in 64 bit. ADO.NET hasn’t replaced ADO classic any more than VB.NET has replaced VBA6 in Access projects.

EDIT: just to clarify, “For Jet 4.0 features it has to be ADO classic,” this is because DAO 3.6 only received a few enhancements for the features new to Jet 4.0. For example, for the DECIMAL data type you cannot specify scale/precision. Other features are missing completely from DAO. For example, can you do the following in Jet 4.0 using DAO (or ACEDAO in ACE for that matter)?

CREATE TABLE Test (
   col1 CHAR(4) WITH COMPRESSION DEFAULT '0000' NOT NULL, 
   CHECK (NOT EXISTS (
                      SELECT T1.col1 
                        FROM Test AS T1 
                        WHERE T1.col1 <> '0000' 
                        GROUP 
                           BY T1.col1 
                       HAVING COUNT(*) > 1
                      ))
);

(hint: compressible fixed-width text column with table-level data integrity constraint.) No, you cannot.

AFAIK the only enhancements to ACEDAO was for the new ACE functionality i.e. they didn’t go back and fill in the Jet 4.0 gaps in DAO. And why should they? We still have ADO to plug the gaps. Better that the team spent their time more productively, like fixing that annoying DECIMAL sort bug, for me the best thing about ACE 😉

Leave a Comment