I have a team of 3 people at work who all use batch files to run Access macros on a regular basis with a command similar to the following:
START "" /min /wait "msaccess.exe" "%TEMP%\Database.accdb" /x Main
At the end of all macros called this way, we end them with a QuitAccess (Exit) action. This usually ends the Access process and hands control back to the batch file to continue.
The issue is that sometimes after the Macro has finished (we can tell it has finished because exported text/Excel files exist) the Access database doesn't close, meaning that the calling batch file is stuck, waiting for Access to close.
When this occurs, we fix it by going into Task Manager and killing the MSACCESS.EXE process. Then the batch file continues.
There isn't anything we can do at the end of the macro, or afterwards in the batch file, to fix this, because the process is stuck in a state between the macro and the batch file.
Does anyone have any ideas on how to prevent this?