What's the difference to CurrentDb or OpenDatabase(CurrentDb.Name)??

  • Thread starter Thread starter Fia
  • Start date Start date
F

Fia

Hi
I'm just wondering what the diffrence is between using the code on the first
row than on the second row.

1. set DB = CurrentDB

2. set DB = Opendatabase(CurrentDB)

Thankful for a description of the difference

Fia
 
CurrentDb is a reference to the Current database

The OpenDatabase method opens the current database, but the syntax is
usually something like:

Set db = DBEngine.OpenDatabase(CurrentDb.Name)

or

Set db = DBEngine.OpenDatabase(0).(CurrentDb.Name)

or more specifically

Set db = DBEngine.OpenDatabase(0).("C:\PathToCurrentDB")

or the path to any database.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
or even dbengine(0)(0) . . .


The CurrentDb method creates another instance of the current database, while
the DBEngine(0)(0) syntax refers to the open copy of the current database.
The OpenDatabase method doesn't actually open the second database in the
Microsoft Access window; it simply returns a Database variable representing
the second database
 
Back
Top