Keep it alive

G

Georges

Hello!

Is it possible to declare an Access.Application object in a module of
another db (let's call it db1), display the application window to the user
interface and keep it alive even when db1 is closed?

Because the database object is closed as soon as the memory used by db1 is
released..

Thanks for any suggestion!
 
G

Georges

Hi Allen!
Thanks for your answer!

It does answer my question. The only thing is that he doesn't show the code
of how it is made. Even if it's made in VB6 or any other language.
So I cannot use it because I want to open the second DB that is secured with
a password (not a workspace password) without asking the user to type it if
his Windows login is recognized.
The code below allows me to do it, but the second DB closes immediately
after that I've closed the current DB.

'===============================================
Sub OpenPasswordProtectedDB()
'Found on MS website http://support.microsoft.com/kb/235422/
Static acc As Access.application
Dim db As DAO.Database, pathDb As String

Shell "MsAccess", vbNormalFocus
Set acc = GetObject("", "Access.Application") 'Take the Access
application that has no database open

acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(pathDb, False, False,
";PWD=myPassword")
acc.OpenCurrentDatabase "C:\Program Files\Microsoft
Office\Office10\Samples\Northwind.mdb"
Docmd.Quit
End Sub
'===============================================

Thanks again for any sugestion!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top