views:

33

answers:

1

Simple (?) question: how can I determine the used DAO version in VBA code?

A: 

By checking the version of the referenced library.

EDIT: If you need to do it in VBA then check resource close to http://www.mvps.org/access/modules/mdl0022.htm (or customize that directly depending on what you need to do)

EDIT2: Few more good resources

Ultimately if you really want to do thing properly (according to MS) you should be moving away from DAO to ADO.

EDIT3: You can try to follow http://support.microsoft.com/kb/240377 to see which files are relevant.

Unreason
How? In VBA code
waanders
Ah, sorry skipped over that; here are more details, but not from code - http://www.accessmvp.com/TWickerath/articles/adodao.htm.
Unreason
I'm using Access 2007. In the References dialog DAO is not checked, only "Microsoft Office 12.0 Access database engine Objects Library". I assume DAO is included, because it works.
waanders
The Add-In is not working. Access says: "Designed for a previous version of Microsoft Office Access". I just want a property telling me which DAO version I'm using (because of a bug in DAO: http://support.microsoft.com/kb/195226)
waanders
>Ultimately if you really want to do thing properly (according to MS) you should be moving away from DAO to ADO.< Not necessarily: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q225048. It says: "DAO and ADO were designed to solve two different problems"
waanders
Unreason> Thanks for your info
waanders
The comment about DAO vs. ADO is completely backwards. DAO is in regular development as the interface layer for Jet/ACE, while ADO classic is completely dead and superseded by the very different ADO.NET.
David-W-Fenton
DAO is accessible in any Access database via the Application.CurrentDB object/function. However, you have to have the DAO reference to use strong data typing for variables (instead of generic objects). Likewise, ADO is accessible without an ADO reference via CurrentProject.Connection (with the same caveats on strong data typing).
David-W-Fenton
"Microsoft Office 12.0 Access database engine Objects Library" *is* the current version of DAO -- look at the name of the referenced DLL.
David-W-Fenton
@David, re DAO/ADO, ah... i stopped following access closely circa 2003, thanks for clarifications
Unreason
So if I use a reference to "Microsoft Office 12.0 Access database engine Objects Library" in my Access project, I'm using DAO and strong data typing?
waanders
Strong data typing is independent of what type libraries you have referenced in your VBA project. Without a reference to DAO, you can't have Dim db As DAO.Database, and you'd have to use Object as your data type. But *with* the reference you don't have to use the stronger data type, and there are instances where that might be useful (though they would be very few -- you don't often use a single variable for different data types when you have the stronger data type available via the type library reference).
David-W-Fenton