Solved

Run Application within an Access Macro

Posted on 2016-10-06
2
36 Views
Last Modified: 2016-10-06
Very simply, I am trying to have an Access Macro launch a .bat file as a first step before moving on to other tasks in the macro. I have tried a number of variations to the command line syntax to enter into Access and not having any luck.

I can get the CMD window to open, I can get it to change directories, but I cannot get it to run the batch file

I've tried:

CMD /k cd \53processing\parse.bat
CMD /k ""cd \53processing" "parse.bat""
CMD /k C:\53processing\parse.bat

and probably 3-4 other variations I've found online, none are working.
0
Comment
Question by:sparker1970
2 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 41832048
The first two will fail:
1. You can't "cd" into a file
2. "cd \53processing" isn't (in all likelihood) a valid command.
The third version should actually run the batch, provided the file "C:\53processing\parse.bat" does exist. With the /k, the prompt will remain open, and you should be able to see potential errors. Note that the script's working directory will probably not be its own directory, so any processing the batch does with relative paths might fail.
To change the directory and then run the bat from there, try
CMD /k cd /d "C:\53processing"&parse.bat

Open in new window

If you want your macro to continue automatically after the batch is done, you need to replace the /k with /c.
0
 

Author Closing Comment

by:sparker1970
ID: 41832115
Worked perfectly...thank you!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now