DAO.DBEngine

DBEngine is the top level object in the DAO object model – all DAO objects and collections are available through DBEngine. For example, from outside Ability Database (e.g. in Spreadsheet or Write):

Set dbapp = CreateObject("AbilityDatabase.Application")

MsgBox dbapp.DBEngine.Version

Inside an Ability Database macro, DBEngine is accessible directly:

MsgBox DBEngine.Version

The Version property simply shows the version of DAO in use.

Another example of using DBEngine is to compact a database. Although this is available from the Tools menu, one of the options in compacting a database is to set a version number.

DBEngine.CompactDatabase "c:\my documents\mydata2.adb", _

"c:\my documents\mydata3.adb", _ 

32 

The code above creates the file mydata3.adb from mydata2.adb and at the same time, compacts the file and converts the version number from 2 to 3. It is the last parameter (32 is equal to the DAO constant dbVersion30) that tells DAO to convert the version number.

Note that Ability creates JET databases using version 2. When creating databases in Microsoft Access 97, the JET version is 3. As far as Ability is concerned, there is no difficulty using either version whereas Microsoft Access will always want to "update" the version if opening version 2.