|
Question : Changing databases.
|
|
I am trying to close one database and open another.
Why doesn't this work?
Public Sub Vermilion() Application.CloseCurrentDatabase Application.NewCurrentDatabase "c:\acadiana\vermilion parish directory.mdb" DoCmd.RunCommand acCmdOpenDatabase End Sub
The current dara base closes OK, but then nothing. BTW the path is correct.
Thanks.
|
|
Answer : Changing databases.
|
|
CloseCurrentDatabase is an Access method. So I guess this Sub lives inside the current database. After you close that database, the code is unloaded and subsequent lines are not executed.
You can't switch databases from within a database.
You can, however, open two databases at the same time from code. So if you don't need to actually use the _interface_ on the second database, just open the second one using the OpenDatabase method. That will open Vermilion.mdb invisibly, but available to VBA manipulation of the data.
|
|
|
|