UNC Pathnames

  • Thread starter Thread starter Reggie Laffond
  • Start date Start date
R

Reggie Laffond

I posted this in "formscoding" forum but it probably should go here.
Thanks in advance for your help.

I want to start a second instance of Access97 from VBA in the first MDB. The
workstations have both Access97 and 2000 so I set up the shell command to
start Access97 and pass as the first (and only) parameter as the mdb name. I
want to use UNC for the mdb path so I won't have to rely on drive mappings
on the various workstations that will use this shell command.

When I run the code:

stAppName = "C:\Program Files\Microsoft Office97\Office\MSAccess.exe" & "
\\SVR-05\DATA\Sample.mdb"
rc = Shell(stAppName,1)

where \\SVR-05 is the server name, DATA is a volume on that server and
Sample.mdb is the database I want to open:

I get the message "The command line you entered to start Microsoft Access
contains an option the Microsoft Access doesn't recognize"

Is it not possible to do what I want to do? Is it the "-" in the server name
that is causing my problem? Also the mdb name has underscores in it. I
didn't include them in the example above because they don't display when the
mdb name is shown as a link.
 
Hello,

Try
stAppName = "C:\Program Files\Microsoft Office97\Office\MSAccess.exe"
"\\SVR-05\DATA\Sample.mdb"

without the &.

Regards

michel
 
Sorry,

I realized that my previous answer was inappropriate (too quickly "read and
answer")

The & is correct but it seems to me, one empty space is missing. I would
write :

stAppName = "C:\Program Files\Microsoft Office97\Office\MSAccess.exe " &
"\\SVR-05\DATA\Sample.mdb"

hope it will help

Michel
 
Reggie Laffond said:
I posted this in "formscoding" forum but it probably should go here.
Thanks in advance for your help.

I want to start a second instance of Access97 from VBA in the first
MDB. The workstations have both Access97 and 2000 so I set up the
shell command to start Access97 and pass as the first (and only)
parameter as the mdb name. I want to use UNC for the mdb path so I
won't have to rely on drive mappings on the various workstations that
will use this shell command.

When I run the code:

stAppName = "C:\Program Files\Microsoft Office97\Office\MSAccess.exe"
& " \\SVR-05\DATA\Sample.mdb"
rc = Shell(stAppName,1)

where \\SVR-05 is the server name, DATA is a volume on that server and
Sample.mdb is the database I want to open:

I get the message "The command line you entered to start Microsoft
Access contains an option the Microsoft Access doesn't recognize"

Is it not possible to do what I want to do? Is it the "-" in the
server name that is causing my problem? Also the mdb name has
underscores in it. I didn't include them in the example above because
they don't display when the mdb name is shown as a link.

I'm not sure, but you may need something like this:

stAppName = _
Chr(34) & _
"C:\Program Files\Microsoft Office97\Office\MSAccess.exe" & _
Chr(34) & " " & Chr(34) & _
"\\SVR-05\DATA\Sample.mdb" & Chr(34)

rc = Shell(stAppName,1)
 
You guys are great. Works perfectly.

While I was waiting for suggestions I found it was the dashes in the server
name that was the problem. They were OK in a shortcut and in a BAT file but
not in the shell function.

Thanks Dirk and all.
 
Back
Top