Opening and Closing Databases

The Stoat

The Grim Squeaker
Local time
Today, 23:14
Joined
May 26, 2004
Messages
239
Hi all,

I'm trying to open Database B from Database A and then close Database A using the following code in Access 2000

Code:
Function OpenPasswordProtectedDB()

Static acc As Access.Application
   
   
Set acc = New Access.Application
    acc.Visible = True
    acc.OpenCurrentDatabase CurrentProject.Path & "\" & "B.mdb", , "MyPassword"
   Application.Quit
   
   
End Function


The code opens database B but when i try to close the Database A it closes both of them. Is there a way around this?

Thanks

TS
 
Try changing Application.Quit to DoCmd.Quit
 
Hi SJ,

Unfortunately that did work either :confused: :(

TS
 
Try....
Code:
Me.Application.Quit
 
It might be because you are making an instance of Database B from Database A and, when you close Database A the instance is then lost and they both close.

Have you tried opening Database B with the Shell() method instead?
 
___ That doesn't work either - there is no me to quit as it is a reference to a form yesno

SJ

I think you are right about instances being linked.

Code:
  Dim retVAL As Double
  retVAL = Shell("MSAccess " & CurrentProject.Path & "\" & "Lockout.mdb", 1)

Would the above code be correct? and how would you get it to open a db with a password?

Thanks

TS
 
___ thanks for the link, i'll give that a look :)

Cheers

TS
 

Users who are viewing this thread

Back
Top Bottom