Passing Parameter in Shell Command

J

Jasmine

Hi All,

I want to pass a parameter string to a shell script command but the
script is not interpreting the passed parameter.

This is the command :

paperclipargs= "Cases|ABEL |DAVID |123456789 |10/4/1941 |29 |"

shell ("\\fortress\pclip32\pclipwin.exe -F") &paperclipargs
(The program runs, but does not pass the parameters)

I tried this command from a command line prompt as
illustrated and it works fine

CMD: \\fortress\pclip32\pclipwin.exe -F
"Cases|ABEL|DAVID|123456789|10/4/1941|29|"
( If I use the command above in the Shell command it bombs )

Is there a way I can run the command prompt as shown above from within
MsAccess?
 
D

Daniel Pineault

I'm not 100% sure but it look to me like you're not including your parameter
with the "".

shell (chr(34) & "\\fortress\pclip32\pclipwin.exe -F" & paperclipargs &
chr(34))

If this doesn't work, please post the extract string you'd normally enter
manually in the Dos command window and I'll be able to set some code up based
on your example.
 
J

Jasmine

Thanks for the response.

the code you've given me didn't work - got a runtime error 53 - file not
found

The Dos command was already posted in my previous email

here it is again:

\\fortress\pclip32\pclipwin.exe -F
"Cases|ABEL|DAVID|123456789|10/4/1941|29|"


ps: don't know how to pass variables from MsAccess to the Dos
command , so i've hard coded the values - but at least I know it
works in this mode.



===================================================
 
D

Daniel Pineault

Jasmine,

Do you mean you enter

\\fortress\pclip32\pclipwin.exe -F

then press enter/return and then at a prompt enter

"Cases|ABEL|DAVID|123456789|10/4/1941|29|"

and press enter/return to launch the sequence?

OR

is this all 1 line

\\fortress\pclip32\pclipwin.exe -F "Cases|ABEL|DAVID|123456789|10/4/1941|29|"

when it is executed?
 
D

Daniel Pineault

Try

paperclipargs = "Cases|ABEL|DAVID|123456789|10/4/1941|29|"
shell ("\\fortress\pclip32\pclipwin.exe -F " & chr(34) & paperclipargs &
chr(34), vbNormalFocus)
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.
 
J

Jasmine

Daniel,

The last codes you've sent me worked like a charm.

(It required a closing bracket, but it's just what the doctor ordered.)

I cannot begin to thank you for your undivided attention to on this problem.

I really appreciate your help.


Jasmine.
 
J

Jasmine

Daniel,
One more question before I leave.

The Soc Security Number is in this format: ###-##-####

What is the code to extract the hyphen

Thanks in advance.
 
D

Daniel Pineault

Use the replace function

replace("###-##-####","-","") - I think but check the help file to confirm
the proper synthax
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.
 
Î

ÎÉÖÉËÉÄÏÕ ÁÃÁÐÇ

Ï "Jasmine said:
Hi All,

I want to pass a parameter string to a shell script command but the
script is not interpreting the passed parameter.

This is the command :

paperclipargs= "Cases|ABEL |DAVID |123456789 |10/4/1941 |29 |"

shell ("\\fortress\pclip32\pclipwin.exe -F") &paperclipargs
(The program runs, but does not pass the parameters)

I tried this command from a command line prompt as
illustrated and it works fine

CMD: \\fortress\pclip32\pclipwin.exe -F
"Cases|ABEL|DAVID|123456789|10/4/1941|29|"
( If I use the command above in the Shell command it bombs )

Is there a way I can run the command prompt as shown above from within
MsAccess?
 
J

John Spencer

I would try adding quote marks to the string you are passing

paperclipargs= CHR(34) & "Cases|ABEL |DAVID |123456789 |10/4/1941 |29 |"
& Chr(34)

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

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