open a DOS application with parameters

G

Guest

hi to all.
i am not a programmer, but i am like good for learn little but fast, i have
an access board and i need to install a new button in the board who call an
external program with certain parameters... I have creted the button in the
past but never accomplish the external DOS application calling, and of course
i have no idea how to call it with parameters.... so please can anybody
giveme a good starting point in order to accomplish it?

Thanks in advance.
Aldo
 
G

Graham Mandeno

Hi Aldo

Use the Shell command:

Shell "C:\somepath\someprogram.exe /x /y"

You can look up Shell in the online help for more details.
 
G

Guest

Thanks for replying.
But how and where I should call that function?

Lets say that i have just created the new button in the design view of the
form.
Thanks!
 
J

John Nurick

While the form is in design view and the button is selected, click on
the Other tab in the property sheet, and replace the commandbutton's
name with something meaningful (e.g. "cmdRunApplication").

Click in the field labelled On Click.... and select [Event Procedure].
Then click on the [...] button next to this field. That will create and
take you to a skeleton procedure called (e.g.)
cmdRunApplication_Click().

Type your code in there. I'd use something like this:

Dim strCmd As String

strCmd = """C:\Program Files\Folder\Application.exe"" -a -b99"

MsgBox strCmd

Shell strCmd

Note how I have had to use additional quote marks to surround the file
path, because it contains a space. The purpose of the MsgBox line is to
show you the actual command that is going to be passed to Shell(), after
the quote marks have been processed. Once you've got the code working
right, you can delete this line.
 

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