dbTalk Databases Forums  

Open a database from a database

comp.databases.ms-access comp.databases.ms-access


Discuss Open a database from a database in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim Devenish
 
Posts: n/a

Default Open a database from a database - 04-12-2011 , 03:37 PM






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

Reply With Quote
  #2  
Old   
 
Posts: n/a

Default Re: Open a database from a database - 04-13-2011 , 04:23 PM






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 (AT) gu8g2000vbb (DOT) 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

Reply With Quote
  #3  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Open a database from a database - 04-14-2011 , 01:16 AM



On Tue, 12 Apr 2011 13:37:41 -0700 (PDT), Jim Devenish
<internet.shopping (AT) foobox (DOT) 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


Quote:
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

Reply With Quote
  #4  
Old   
stefan
 
Posts: n/a

Default Re: Open a database from a database - 04-14-2011 , 02:38 AM



yout got an answer here:

https://groups.google.com/forum/?fromgroups#!topic/microsoft.public.access.forms/Fs-Y8OMm3xw

Reply With Quote
  #5  
Old   
Charles Hottel
 
Posts: n/a

Default Re: Open a database from a database - 04-14-2011 , 09:34 AM



"Jim Devenish" <internet.shopping (AT) foobox (DOT) com> wrote

Quote:
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.

Reply With Quote
  #6  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Open a database from a database - 04-17-2011 , 03:57 PM



Jim Devenish <internet.shopping (AT) foobox (DOT) com> wrote in
news:0b4510ac-d415-4c2c-b200-7546aae178a4 (AT) gu8g2000vbb (DOT) googlegroups.co
m:

Quote:
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/

Reply With Quote
  #7  
Old   
Jim Devenish
 
Posts: n/a

Default Re: Open a database from a database - 04-18-2011 , 04:21 AM



On Apr 17, 9:57*pm, "David-W-Fenton" <NoEm... (AT) SeeSignature (DOT) invalid>
wrote:
Quote:
Jim Devenish <internet.shopp... (AT) foobox (DOT) com> wrote innews:0b4510ac-d415-4c2c-b200-7546aae178a4 (AT) gu8g2000vbb (DOT) 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/
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

Reply With Quote
  #8  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Open a database from a database - 04-24-2011 , 11:45 PM



Jim Devenish <internet.shopping (AT) foobox (DOT) com> wrote in
news:e2a50171-d781-4a5a-8e40-3a4b18e1c83e (AT) v31g2000vbs (DOT) googlegroups.co
m:

Quote:
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/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.