To show that the CurrentDb function adds to the Databases collection
Sub exaCurrentDb()
Dim db, dbExtra, dbOriginal As Database
Dim str As String
Dim i As Integer
Set dbOriginal = DBEngine(0)(0)
Debug.Print DBEngine.Workspaces(0).Databases.Count
Set dbExtra = CurrentDb()
Debug.Print DBEngine.Workspaces(0).Databases.Count
For Each db In DBEngine.Workspaces(0).Databases
Debug.Print db.Name
Next db
dbExtra.Close
End Sub
Related examples in the same category