Open a new DB and close the close the original DB

P

PJFry

I have a group of users who are working off of a front end DB that is updated
periodically with new features and reports. When it comes time to publish
one of these DBs I want to flag the user for an update and have a process
where a new DB opens and the original DB closes. The new DB places a new
copy of the updated front end on the users desktop and closes.
I have all of this working except for the a way to close the original DB.
Here is the code the opens the new DB. This is on the OnLoad event and is
triggered by a flag on the users account.


Public appAccess As Access.Applicatio
----------------------------------------------------------------------------------
strDB = "L:\2008\Inventory\Inventory.mdb"

Set appAccess = CreateObject("Access.Application")

With appAccess
.OpenCurrentDatabase strDB
.Visible = True
End With

The problem is that if I use DoCmd.Quit or DoCmd.CloseDatabase, both DBs
close. Is there a way to only close the original?

That being said, is there a better way to execute this open and close routine?

I am running Access 2007 on Windows XP Pro. Both the databases in question
are still in a 2003 format for compatibility.

Thanks!
PJ
 
R

Rick Brandt

I have a group of users who are working off of a front end DB that is
updated periodically with new features and reports. When it comes time
to publish one of these DBs I want to flag the user for an update and
have a process where a new DB opens and the original DB closes. The new
DB places a new copy of the updated front end on the users desktop and
closes. I have all of this working except for the a way to close the
original DB. Here is the code the opens the new DB. This is on the
OnLoad event and is triggered by a flag on the users account.


Public appAccess As Access.Application
----------------------------------------------------------------------------------
strDB = "L:\2008\Inventory\Inventory.mdb"

Set appAccess = CreateObject("Access.Application")

With appAccess
.OpenCurrentDatabase strDB
.Visible = True
End With

The problem is that if I use DoCmd.Quit or DoCmd.CloseDatabase, both DBs
close. Is there a way to only close the original?

That being said, is there a better way to execute this open and close
routine?

I am running Access 2007 on Windows XP Pro. Both the databases in
question are still in a 2003 format for compatibility.

You can't open the new file with automation because (as you have seen)
that makes it dependent on the file you want to close. Use SHELL or
FollowHyperlink to open the new file and then there is no dependency on
the first one.
 
P

PJFry

That did the trick. Thanks!

Rick Brandt said:
You can't open the new file with automation because (as you have seen)
that makes it dependent on the file you want to close. Use SHELL or
FollowHyperlink to open the new file and then there is no dependency on
the first one.
 

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