By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Shell command won't work using file server path

P: n/a
RLN
Re: Access 2003/WinXP Pro-SP3

I have a shell command that does not run correctly.

I have two programs located on a file server: Pgm1.mdb and Pgm2.mdb

Pgm1 launches Pgm2 via a command button using a shell command.
The old method ran fine when the specified file server was mapped on
the user's workstation as a drive letter (U)
strAppName = "msaccess.exe " & "U:\Access_EQ\EQ-NonCorp.MDB"
Call Shell(strAppName, 1)

However, hard coding the drive letter in the path is not wise, so I
wanted to specifiy the server this way by its full path:
\\kcnccp50y\Financial Accounting Restricted\Access_EQ\NonCorp\
(Pgm1.mdb uses this path very nicely when importing excel file from
this server, etc.)

When Pgm1 calls Pgm2 (they are in the same folder on the file server)
this does not work:
stAppName = "msaccess.exe " & "\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB".
Call Shell(strAppName, 1)

The error received is:
"The command line you used to start Microsoft Access contains an option
that Microsoft Access doesn't recognize."

Is there a work around for this so I can call another program using the
actual file server share name in lieu of a drive letter (which may or
may not be mapped correctly on every user's workstation?)

Thanks,
RLN

May 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"RLN" <rl***************@yahoo.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Re: Access 2003/WinXP Pro-SP3

I have a shell command that does not run correctly.

I have two programs located on a file server: Pgm1.mdb and Pgm2.mdb

Pgm1 launches Pgm2 via a command button using a shell command.
The old method ran fine when the specified file server was mapped on
the user's workstation as a drive letter (U)
strAppName = "msaccess.exe " & "U:\Access_EQ\EQ-NonCorp.MDB"
Call Shell(strAppName, 1)

However, hard coding the drive letter in the path is not wise, so I
wanted to specifiy the server this way by its full path:
\\kcnccp50y\Financial Accounting Restricted\Access_EQ\NonCorp\
(Pgm1.mdb uses this path very nicely when importing excel file from
this server, etc.)

When Pgm1 calls Pgm2 (they are in the same folder on the file server)
this does not work:
stAppName = "msaccess.exe " & "\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB".
Call Shell(strAppName, 1)

The error received is:
"The command line you used to start Microsoft Access contains an option
that Microsoft Access doesn't recognize."

Is there a work around for this so I can call another program using the
actual file server share name in lieu of a drive letter (which may or
may not be mapped correctly on every user's workstation?)

Thanks,
RLN


Try adding double quotes around your path so the shell command receives the
path with quotes

stAppName = "msaccess.exe " & """\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB""".
May 18 '06 #2

P: n/a
RLN
Try adding double quotes around your path so the shell command receives the
path with quotes


Global Const gblPgmPath = ""\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\Corp\""
Actually, I have it declared like you see above, but I want to use it
in a variable, 'gblPgmPath' then reference it in various locations in
the application (in Shell statements and other code) like:
stAppName = "msaccess.exe " & gblPgmPath
The problem here is when I compile, I get an error "Expected
Expression" & the compiler highlights the 2nd forward slash in the
"global const" line of code as I have referenced above.

Due to this error, am I stuck hard coding it in my application like
this:
stAppName = "msaccess.exe " & """\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB"""

Thanks.

May 19 '06 #3

P: n/a
Was this a type for your message? In one place it is:

Global Const gblPgmPath = ""\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\Corp\""
but then later you say it is:

"""\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB"""

In one place it is \Corp\ in the other place it is \NonCorp\
In one place you include the mdb name in the other palce you do
not..

stAppName = "msaccess.exe " & gblPgmPath
(without mdb name)

and then:
stAppName = "msaccess.exe " & """\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB"""

May 22 '06 #4

P: n/a
RLN

stAppName = "msaccess.exe " & """\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB"""

this worked! Thank you.
Ron2006 wrote:
Was this a type for your message? In one place it is:

Global Const gblPgmPath = ""\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\Corp\""
but then later you say it is:

"""\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB"""

In one place it is \Corp\ in the other place it is \NonCorp\
In one place you include the mdb name in the other palce you do
not..

stAppName = "msaccess.exe " & gblPgmPath
(without mdb name)

and then:
stAppName = "msaccess.exe " & """\\kcnccp50y\Financial Accounting
Restricted\Access_EQ\NonCorp\EQ-NonCorp.MDB"""


May 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.