Solved

Run Application within an Access Macro

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

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

920 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