can I run an exe. file from a command button in access?

J

JIXPIX

I have a very small .exe file which I understand from the manufacturers just
'kicks' open a cash drawer - can I add the instruction to run it to a button
in MS Access? please be kind, struggling here!

Outside of Access the file runs without a problem, probably being dense but
cannot see how to add command to the button!

Thanks in anticipation of help!
 
D

Dirk Goldgar

JIXPIX said:
I have a very small .exe file which I understand from the manufacturers
just
'kicks' open a cash drawer - can I add the instruction to run it to a
button
in MS Access? please be kind, struggling here!

Outside of Access the file runs without a problem, probably being dense
but
cannot see how to add command to the button!


You should be able to use the Shell function to run the .exe. Something
like this code for the button's Click event:

'----- start of code -----
Private Sub cmdOpenDrawer_Click()

Shell "C:\Program Files\Some Folder\OpenDrawer.exe", vbMinimizedNoFocus

End Sub
'----- end of code -----

Obviously, you have to correct the names and path in the above example.
 
D

Douglas J. Steele

Use the Shell function:

Shell """C:\Program Files\MyApp\MyApp.exe"""

That's three double quotes in a row before and after: because of the space
in the path, you need to ensure that there are quotes around the path, and
to put quotes in a quoted string, you need to double the quotes.
 
D

Dirk Goldgar

Douglas J. Steele said:
Use the Shell function:

Shell """C:\Program Files\MyApp\MyApp.exe"""

That's three double quotes in a row before and after: because of the space
in the path, you need to ensure that there are quotes around the path, and
to put quotes in a quoted string, you need to double the quotes.


I don't seem to need the quotes if there are no command-line arguments.
 
D

Douglas J. Steele

You could be right. I didn't test, but it makes sense that it would see
everything before the comma as a command.
 

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