I want to use Vortex <EXEC> to synchronously (i.e., EXEC and wait for the call to return before proceeding) run Microsoft Access, passing the name of a database and a command line to Access. The code embedded in the Access database runs, reads the command line (which, by the way, is the path of a simple text file built by the Vortex script which in turn contains a comma-delimited string of data), opens the text file, reads the comma-delimited string of data contained therein, does stuff with the data, then quits, passing control back to the Vortex script which continues. Simple enough. But it does not seem to work. The Access code works fine. I have tested it many many times. The Vortex script correctly builds the text file. But the <EXEC> does not start Access and I cannot figure out why.
The path to Access is:
C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE
The path to the database is:
D:\Crosshairs\external\My Database With Code.accdb
The command line is:
To pass a command line to Access, from a command prompt, the syntax is:
MSAccess.exe <databasename> /cmd <commandline>
I realize there are spaces in the paths, and have tried every combination I can think of of using NOQUOTEARGS vs. QUOTEARGS, using quotes to surround the various parameters on the <EXEC> line, using STDERRTOFILE, using -- before the start of the command, etc. Nothing seems to work.
Shouldn't the following work, and if not, why?
<exec stderrtofile="D:\Crosshairs\accesscallerr.txt" noquoteargs -- "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "D:\Crosshairs\external\My Database With Code.accdb" /cmd "D:\Windows\TEMP\CMD_577df59c3.txt"></exec>
This seems to do nothing at all. Moreover, the file D:\Crosshairs\accesscallerr.txt is empty, and the value of $ret returned by <EXEC> is also empty.
Ideally, I'd write each of the paths to a variable so the code looks a little neater. Also, ideally, I'd like to put the call to the Access EXE in a batch file and use
cmd.exe /c TheBatchFile.bat
to call that instead of calling Access directly.
(The reason for this is that Access is not installed in the same directory on every server where we run the Vortex script. As it is now, the Vortex script on each server will have to be "customized" for that server's Access installation. This was the first thing I attempted, but when that didn't work I simplified things -- or so I thought -- calling Access directly.)
Again, I realize that this is *possibly* not a Vortex issue at all. But if the <EXEC> stament in my Vortex script is incorrect, maybe it IS a Vortex issue.