Opening a new mdb from existing mdb

J

Jim Pockmire

Is it possible to open a new mdb using Call Shell("command line for path to
MS-Access and mdb to open")? If so,

1. can I specify the default location of MS-Access rather than fully
defining C:\Program Files\...

2. similarly, can I specify an mdb in the same folder as the current mdb
without fully defining the path?

I recall their being variables that start with a % or $ that may do this,
e.g. $(AppPath).
 
S

StCyrM

Good morning

The following code should do it for you.

Sub OpenExistingDataBase()
Dim retVal As Long
Dim AccPath As String
Dim DbPath As String

AccPath = "C:\Program Files\Microsoft Office\Office\MSAccess.exe"
DbPath = "D:\db1.mdb"

retVal = Shell(AccPath & " " & DbPath)

End Sub


Best Regards

Maurice St-Cyr
Micro Systems Consultants, Inc.
 
J

Jim Pockmire

What about using intrinsic variables (if that is the right term)? e.g. Can I
sustitute something like $(appPath)\MsAccess.exe for "C:\Program
Files\Microsoft Office\Office\MSAccess.exe". This way if the user had the
program in a different folder or was running it from the network, it would
find the program.

Similarly, is there variable to refer to the folder that the currently open
database resides in?
 

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