Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Run Application within an Access Macro

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

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
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…

839 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