Opening another database

RogerB

Registered User.
Local time
Today, 03:02
Joined
May 25, 2000
Messages
10
Several other people have asked similar questions but didn't get much response. I thought I'd try my luck.

The following code isn't working.

Dim dbs As Database, wsp As Workspace

Set wsp = DBEngine.Workspaces(0)

Set dbs = wsp.OpenDatabase("H:\Access Databases\Copyright\Copyright Search.mdb")

The databse "Copyright Search.mdb" is supposed to open with a particular from in view but nothing happens.

I'm not even getting any error messages.

Can anyone help?

Thanks

Roger
 
A bit of reading of the help files on workspaces leads me to believe that they aren't actually for that purpose.

I don't think it is possible to have two databases open in the one application occurance. You can however open another occurance of Access with your other file using:

Dim appAccess As Access.Application

in the declarations section of your code, then

Set appAccess = GetObject("C:\My Documents\another.mdb", "Access.Application.8")

I'm having a few problems closing down the initial database however.

Application.Quit acExit is closing them both due to the focus being on the newly opened one once it is open.
 
I do it by calling code, as follows:

Function Copyright() As String
'Allows the authorized user to access Copyright Search Database

Dim stAppName As String

stAppName = "MSACCESS.EXE H:\Access Databases\Copyright\Copyright Search.mdb"

Call Shell(stAppName, 1)

End Function
 

Users who are viewing this thread

Back
Top Bottom