Getting Access to run an external .exe

T

Travis

I'ev just programmed a button which exports data to a CSV file. I've
got a little .exe application which when run takes data from this CSV
file, processes it, then outputs to another CSV file.

The button already does the job of exporting to CSV.

I want to know how to get it to run the .exe, wait for it to finish
because depending on the internet connection speed it could take
several minutes to run, and then import the output file into my
database and run an update query.

How do I call a .exe and how can I tell Access to wait until the .exe
has finished running before importing the output file?

Travis
 
T

Travis

Douglas said:
Use the Shell command to run it.

See http://www.mvps.org/access/api/api0004.htm at "The Access Web" for how
to wait until the Shell command has completed.

Thanks Doug,

My understanding of VBA is not good enough for me to be able to follow
the code (even with comments), so I don't know how this works.

Do I just copy and paste that block of code exactly as it appears in
the article into my button code in between the point where my .exe is
launched and the next step? Or do I need to modify it?

Travis
 
D

Douglas J. Steele

Travis said:
Thanks Doug,

My understanding of VBA is not good enough for me to be able to follow
the code (even with comments), so I don't know how this works.

Do I just copy and paste that block of code exactly as it appears in
the article into my button code in between the point where my .exe is
launched and the next step? Or do I need to modify it?

Copy what's between Code Start and Code End into a new module. Make sure you
don't name the module the same as any of the routines in it.

Then, where you would be calling the executable, use

ShellWait FullPathToExecutable

You can also pass a Windows Style parameter after the full path to the
executables: the acceptable values are the exact same values described in
the Help file for the Shell function.
 

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