Solved

Run Application within an Access Macro

Posted on 2016-10-06
2
58 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use DLookup with IsNull Function 4 27
DCount Type Mismatch 2 22
MS Access Delete All Excel sheets 1 10
access query to sql server 3 22
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

831 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