f



Open a database from a database

I want to be able to open and run an Access database from within an
already running one.  The OpenDatabase command simply opens it but
does not run the startup routine.  Interestingly opening from Windows
Explorer has a different meaning in that it opens and runs!

What command enables me to open another database and get it to run its
AutoExec macro, from code?

Jim
0
4/12/2011 8:37:41 PM
comp.databases.ms-access 42670 articles. 0 followers. Post Follow

7 Replies
1709 Views

Similar Articles

[PageSpeed] 1

I don't know the answer, but I do know that when you use OpenDatabase the 
code in a startup form of that database does work.

Martin

"Jim Devenish"  schreef in bericht 
news:0b4510ac-d415-4c2c-b200-7546aae178a4@gu8g2000vbb.googlegroups.com...

I want to be able to open and run an Access database from within an
already running one.  The OpenDatabase command simply opens it but
does not run the startup routine.  Interestingly opening from Windows
Explorer has a different meaning in that it opens and runs!

What command enables me to open another database and get it to run its
AutoExec macro, from code?

Jim 

0
martin8990 (22)
4/13/2011 9:23:44 PM
On Tue, 12 Apr 2011 13:37:41 -0700 (PDT), Jim Devenish
<internet.shopping@foobox.com> wrote:

Have you tried the Shell command?

If you weren't using the AutoExec macro but one with another name, you
could use the /X command line switch for msaccess.exe

-Tom.
Microsoft Access MVP


>I want to be able to open and run an Access database from within an
>already running one.  The OpenDatabase command simply opens it but
>does not run the startup routine.  Interestingly opening from Windows
>Explorer has a different meaning in that it opens and runs!
>
>What command enables me to open another database and get it to run its
>AutoExec macro, from code?
>
>Jim
0
4/14/2011 6:16:32 AM
yout got an answer here:

https://groups.google.com/forum/?fromgroups#!topic/microsoft.public.access.forms/Fs-Y8OMm3xw
0
s.schk (1)
4/14/2011 7:38:00 AM
"Jim Devenish" <internet.shopping@foobox.com> wrote in message 
news:0b4510ac-d415-4c2c-b200-7546aae178a4@gu8g2000vbb.googlegroups.com...
>I want to be able to open and run an Access database from within an
> already running one.  The OpenDatabase command simply opens it but
> does not run the startup routine.  Interestingly opening from Windows
> Explorer has a different meaning in that it opens and runs!
>
> What command enables me to open another database and get it to run its
> AutoExec macro, from code?
>
> Jim

One database I work with does this via an Autoexec macro that contains 
RunCode, OpenForm and Maximize commands.

You can also use Tools > Startup > Display Form/Page:

The above is used in Access 2003. 


0
chottel (600)
4/14/2011 2:34:59 PM
Jim Devenish <internet.shopping@foobox.com> wrote in
news:0b4510ac-d415-4c2c-b200-7546aae178a4@gu8g2000vbb.googlegroups.co
m: 

> I want to be able to open and run an Access database from within
> an already running one.  The OpenDatabase command simply opens it
> but does not run the startup routine.  Interestingly opening from
> Windows Explorer has a different meaning in that it opens and
> runs! 
> 
> What command enables me to open another database and get it to run
> its AutoExec macro, from code?

It all depends on what you want to do.

You can use Shell(), but that launches an independent instance of
Access and you don't have much control over it (though if you use
the function version of Shell() you can get the process ID and then
kill it if you need to). The advantage there is that you can close
the launching application without affecting the one you launched
from it. 

Alternatively, you could use automation for full control, but that
makes the second instance dependent on the first. That may be an
advantage or a disadvantage. 

Another option is Michael Kaplan's SOON utility:

  http://trigeminal.com/lang/1033/utility.asp?ItemID=8#8

I've never used it, but it could be what you need.

Last of all, you might consider whether you need a new instance or
not. If all your trying to do is run some queries or output some
reports that are done in the startup routine of the app, it would
make more sense to move that functionality to code that is called
from the startup routine, but could also then be called without
necessarily needing to open the app in a new instance of Access. But
whether that is possible or not will depend on what tasks are being
performed. 

-- 
David W. Fenton                  http://www.dfenton.com/ 
contact via website only     http://www.dfenton.com/DFA/
0
NoEmail4557 (375)
4/17/2011 8:57:28 PM
On Apr 17, 9:57=A0pm, "David-W-Fenton" <NoEm...@SeeSignature.invalid>
wrote:
> Jim Devenish <internet.shopp...@foobox.com> wrote innews:0b4510ac-d415-4c=
2c-b200-7546aae178a4@gu8g2000vbb.googlegroups.co
> m:
>
> > I want to be able to open and run an Access database from within
> > an already running one. =A0The OpenDatabase command simply opens it
> > but does not run the startup routine. =A0Interestingly opening from
> > Windows Explorer has a different meaning in that it opens and
> > runs!
>
> > What command enables me to open another database and get it to run
> > its AutoExec macro, from code?
>
> It all depends on what you want to do.
>
> You can use Shell(), but that launches an independent instance of
> Access and you don't have much control over it (though if you use
> the function version of Shell() you can get the process ID and then
> kill it if you need to). The advantage there is that you can close
> the launching application without affecting the one you launched
> from it.
>
> Alternatively, you could use automation for full control, but that
> makes the second instance dependent on the first. That may be an
> advantage or a disadvantage.
>
> Another option is Michael Kaplan's SOON utility:
>
> =A0http://trigeminal.com/lang/1033/utility.asp?ItemID=3D8#8
>
> I've never used it, but it could be what you need.
>
> Last of all, you might consider whether you need a new instance or
> not. If all your trying to do is run some queries or output some
> reports that are done in the startup routine of the app, it would
> make more sense to move that functionality to code that is called
> from the startup routine, but could also then be called without
> necessarily needing to open the app in a new instance of Access. But
> whether that is possible or not will depend on what tasks are being
> performed.
>
> --
> David W. Fenton =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0http://www.dfenton.com=
/
> contact via website only =A0 =A0http://www.dfenton.com/DFA/

The SOON utility looks very much what I am looking for.  He explains
the situation I have: "Have you ever wanted to close a database, then
maybe compact it, and maybe open it back up?

I want to compact and repair my database and reopen it.  To do this I
want to pass its pathname to a table in a second database; close the
first and open the second; from here compact and repair the first and
then reopen it.

This need has arisen in a surprising way.  I have just moved a number
of applications from A2000 to A2010 and find that in each of them when
I now relink the front end to a new backend, the database needs
compacting or else errors occur.  I can't find an explanation about
why what worked previously is now causing a problem, so I am trying
to get round it by automating the compaction.

Jim
0
4/18/2011 9:21:38 AM
Jim Devenish <internet.shopping@foobox.com> wrote in
news:e2a50171-d781-4a5a-8e40-3a4b18e1c83e@v31g2000vbs.googlegroups.co
m: 

> This need has arisen in a surprising way.  I have just moved a
> number of applications from A2000 to A2010 and find that in each
> of them when I now relink the front end to a new backend, the
> database needs compacting or else errors occur.  I can't find an
> explanation about why what worked previously is now causing a
> problem, so I am trying to get round it by automating the
> compaction. 

Are you updating the linked tables or recreating them from scratch?

-- 
David W. Fenton                  http://www.dfenton.com/ 
contact via website only     http://www.dfenton.com/DFA/
0
NoEmail4557 (375)
4/25/2011 4:45:26 AM
Reply: