David, do you know why it's preferable to use CurrentDb(), and when?
dbEngine(0)(0) stands for:
dbEngine.Workspaces(0).Databases(0)
which refers to the default database that is open in the default workspace.
Since it is already open, it has the advantage of speed (it's already there
to use), and the disadvantage of currency (it may not be completely up to
date, or could have been messed with.)
Whenever you make a call to CurrentDb() creates a *new* object, flushes all
the collections of the current database, and then points the new object to
the database. It has the advantage of being current, but the disadvantage of
being slower. Further, multiple calls to CurrentDb() are not referring to
the same object.
The main speed difference is the time it takes to flush all the collections
of the database. According to michka's tests, this makes CurrentDb() about
5000 times slower than dbEngine(0)(0). In practice, that's largely academic:
if you were using CurrentDb(), you would declare a database variable before
the loop rather than call CurrentDb() repeatedly in the loop.
A more significant difference is newbies use multiple references to
CurrentDb, not understanding that they are different objects. For example,
this doesn't work:
CurrentDb().Execute strSql
Debug.Print CurrentDb().RecordsetAffected
More significant, if you have been modifying the database structure, there's
a good chance that dbEngine(0)(0) will not be up to date with the new
changes, so CurrentDb() is essential for those cases.
There are also cases where dbEngine(0)(0) is not what you expect. When
wizards run, you can end up with the wizard database as dbEngine(0)(0), and
the current database is therefore dbEngine(0)(1). That can also happen while
multiple database objects are open in transactions, i.e. they can rollback
into a different order.
So, in general, CurrentDb() is safer than dbEngine(0)(0). But in a
production database where the data structure is not being modified and
wizards are not running, dbEngine(0)(0) will be fine.
HTH.