2 Replies Latest reply: May 15, 2014 9:56 AM by Jose _ RSS

    Monarch Batch (BAT) File

    Jose _

      Hi all, I have written a batch file that, in short, opens a MS Access Database, runs a Macro, Opens Monarch then runs a project export, and finally Opens a MS Access Database and Exports a report.


      My question is does anyone know how to close the MS Access Database via code entered in the BAT file?


      Below is what I have written at the moment


      'Set Variables


      setDB_NAME="europe.shell.comeuropeOtherSSSCGLA GlasgowDepartmentSSSCGLA Shared DataSAP to GSAPUKSAP vs GSAP.mdb"


      ' Open MS Access

      "C:Program FilesMicrosoft OfficeOfficemsaccess.exe" %DB_NAME% /x Macro1


      'Close Database

      ??????????  :confused:    :confused:  ?????????????


      'Open Monarch and Export


      "c:program filesmonarchprogrammonarch.exe" "europe.shell.comeuropeOtherSSSCGLA GlasgowDepartmentSSSCGLA Shared

      DataSAP to GSAPGSAP Project.xprj" /pxall


      'Open Database and run a Macro


      "C:Program FilesMicrosoft OfficeOfficemsaccess.exe" %DB_NAME% /x Macro2

        • Monarch Batch (BAT) File
          Data Kruncher

          Hi Jose,


          It seems to me that your solution lies not in adding a command to close the data in your batch file, but instead to append a "Quit" command to the end of your Access macro "Macro1". The default option for the Quit command is "Save All". This will save any changes and close Access.


          If you use Macro1 at other times and don't want the macro to always close Access, make a duplicate of Macro1 and add the "Quit" command to that macro. Then change your BAT file to call that macro instead of Macro1.




          • Monarch Batch (BAT) File
            Jose _

            Excellent thanks.  I was too busy think I need to put a command in the batch file and not think how I could do it another way.


            Anyway it works great so many thanks!!