Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a new database from another one..

Status
Not open for further replies.

mike777

Programmer
Jun 3, 2000
387
0
0
US
Is there a way to do this?
I am trying:
Code:
Sub sub_OpenTruePrequal()
    Dim app_Access As New Access.Application, dBs As DAO.Database
    app_Access.OpenCurrentDatabase "c:\mydb\mydb.mdb"
    app_Access.Visible = True
    Application.quit
End Sub

and the problem is that when I hit the line
Code:
Application.quit
,
both databases close.
I've even tried
Code:
dim acc_App as access.application
in the declarations section of the module, and then
Code:
set acc_App=access.application
in the first procedure that runs.
Code:
Sub sub_OpenTruePrequal()
    Dim app_Access As New Access.Application, dBs As DAO.Database
    app_Access.OpenCurrentDatabase "c:\mydb\mydb.mdb"
    app_Access.Visible = True
    acc_App.quit
End Sub

Both databases still disappear.
Any ideas?
Thanks.
-Mike

 
instead of quit use Application.CloseCurrentDatabase

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Hi ToeShot,
Thanks for the response.
Yeah, I tried that (should have mentioned that in my posting, but it was late and I was heading home in a big way) and that is OK, but not preferable, since it leaves a blank Access window on the screen (I mean like if you open one document in MS Word, then close the document, Word is still open, there's just no document). The other Access database is in its own window.
It's really confusing...seems like a bug or something, because you can start two Excel application objects and close one. I have done that several times. Here, I have two MS Access application objects. It doesn't seem to me that both should close when you close only one.
Thanks again.
-Mike
 
I am currently at school, I have an Access Application that opens another database at home. When I get back Homne I will look at it and let you know what I find.

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
ToeShot:
I got it.
I used the Shell function to open the new database. Then I can just say "application.quit" and it closes the database (and application instance) that calls the second database. The second database is unaffected by the quit command. I guess creating a second instance of the Access application doesn't work (on XP?); it keeps everything under one instance???
Thanks.
-Mike
 
In my code I never show the second database that is open I perform some counts on the objects in the database and I show the names of the Objects. At some points I do open the Objects (tables and queries) but then close them. I never see a second Access envirorment oprened up. Sorry I could not be of more help.

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Toeshot,
Yeah, with the way you can link tables and queries and import all the other objects, opening a second database is not really **necessary**, I suppose. But having that option available to me, I think, will be helpful nonetheless.
Best of success!!
-Mike
 
mike777,
I getting ready to do the same thing here. Would be awesome if i had a go by to start with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top