Monarch Command Loop Export/Add to Microsoft Access mdb File

Leon K
Leon K Altair Community Member
edited March 2021 in Community Q&A

Hello, I am a newbie, apologies if this has already been covered. I am trying to use Windows Command batch to loop through all files within a folder. I have seen on another thread where within the loop - for each file Monarch is opened and processes each file. I am having an issue where I am trying to export and append to the same Microsoft Access file (.mdb). What happens is that when Monarch adds to the mdb file it temporarily locks out the file for editing. Even though I run the same script, different amounts of data are appended to the database each time. How do I got about resolving the issue? Ideally I would only want to call Monarch once and then have a loop to open all reports within the same folder at once and once that loops is done add to and append to my mdb. Any help is appreciated, Thanks!

Current expression:

for %i in ("d:\etc\etc\*.doc") do  "C:\Program Files (x86)\Monarch\Program\Monarch.exe"/rpt:"%i" /mod:"d:\etc\etc.xmod" /expfileopt:add /exp:"d:\etc\etc.mdb" /exptableopt:append /exptable:"Newtable" \T

 

Tagged:

Answers

  • CPorthouse
    CPorthouse
    Altair Employee
    edited March 2021

    How many reports are you looping through?  You can call the /rpt multiple times from the same command line, so maybe you can try building out a report string similar to:

    /rpt:file1.doc /rpt:file2.doc /rpt:file3.doc and so on.

    I was also able to use a wildcard character in my quick test /rpt:"class*.prn"

    One other note, make sure you use /T for the table view.  Your question shows \T instead.  Just making sure that wasn't a typo.

  • Leon K
    Leon K Altair Community Member
    edited March 2021

    How many reports are you looping through?  You can call the /rpt multiple times from the same command line, so maybe you can try building out a report string similar to:

    /rpt:file1.doc /rpt:file2.doc /rpt:file3.doc and so on.

    I was also able to use a wildcard character in my quick test /rpt:"class*.prn"

    One other note, make sure you use /T for the table view.  Your question shows \T instead.  Just making sure that wasn't a typo.

    Hi Chris, Thank you so much for your reply. The destination folder of my reports can vary day to day. One day there may be 5 files in there, another day there can be 50. I tried using the wildcard /rpt:"d:\etc\etc\*.doc" and Monarch will open up but tells me Cannot open file d:\etc\etc\*.doc. I have double checked my destination folder of the reports and directly copied and pasted into the expression. I have also chosen a specific report from that folder and it was able to open the report. Thank you for pointing out \T vs /T. It was indeed a typo.