
Opening different database
True, though I read Mr. Proefrock's post as saying that Access did in
fact open, but didn't understand the DB name.
As an alternative, one could use MichKa's TSI SOON (Shut One, Open
New) add-in:
http://www.trigeminal.com/lang/1033/utility.asp?ItemID=8#8
That's what I'd do.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Quote:
> Actually, unless msaccess.exe is located in a folder that's included
in the
> PATH environment variable, I believe you have to give a full path to
where
> it's located.
> Fortunately, this is relatively easy: SysCmd(acSysCmdAccessDir) will
return
> that information.
> Shell Chr$(34) & SysCmd(acSysCmdAccessDir) & _
> "msaccess.exe" & Chr$(34) & " " _
> Chr$(34) & CurrentDBDir() & _
> "TheOtherFile.mdb" & Chr$(34)
> Don't forget the space between the executable name and the database
name.
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> > Try
> > Shell "msaccess.exe " & _
> > Chr(34) & CurrentDBDir() & "TheOtherFile.mdb" & Chr(34)
> > --
> > Dirk Goldgar, MS Access MVP
> > www.datagnostics.com
> > (please reply to the newsgroup)
> > > I am trying to open another database and close the current one
from
> > a
> > > switchboard button. I have searched the newsgroup and found this
> > code:
> > > Dim lRetVal As Long
> > > lRetVal = Shell("msaccess.exe C:\TheOtherFile.mdb")
> > > Application.Quit
> > > I have built a function that returns the current path of the
> > database but I
> > > can't plug it into the shell command and make it run properly.
What
> > I've
> > > tried is:
> > > Shell("msaccess.exe" & CurrentDBDir() & "TheOtherFile.mdb").
But
> > when
> > > this runs it tells me I have used an improper command line
option
> > and then a
> > > second screen shows me it was trying to open a file called
> > C:/My.mdb.
> > > Can anyone give me suggestions on how to parse this data
together
> > and get it
> > > to run. the Function "CurrentDBDir" returns the full path of the
> > current
> > > database and where my other database is also located = the
string
> > begins
> > > with the Drive letter and ends with "\"
> > > My intention is to use a menu button to switch to the 2nd
database
> > and close
> > > the current one and vice-versa in the other. I prefer not to
leave
> > both open
> > > at the same time.
> > > Thanks for any help you can offer
> > > Paul P