2 Replies Latest reply: May 15, 2014 10:03 AM by aceinthecorner2005 _ RSS

    Exporting multiple projects to Access via a .bat

    aceinthecorner2005 _

      I have a couple dozen fairly sizeable reports that are created each evening.  I have a model and project written for each, and have a simple .bat script written to run the projects, perform the exports, and then /wait for 15 seconds, rinse and repeat for all.

       

      It worked well at first but now I am running into problems.  What happens is:  a project will open and everything looks great but when it tries to export it might say that Access is in use and the export fails.  It seems to be happening more and more the larger the database gets.  It is my theory that the prior export is sent to Access and then Access "clocks" longer than my wait.

       

      Other than putting in unpractical wait times does anyone have any suggestions as to how I can bullet proof my .bat or ensure than all of my project succeed?

       

      PLEASE and many many thanks.

        • Exporting multiple projects to Access via a .bat
          Nick Osdale-Popa

          Couple of options come to mind if you're fairly confident in batch file syntax.

           

           

          First, if the Access DB is indeed still open, you could check that the lock file (.LDB) exists. Once Access closes, the lock file will be deleted. You could to a rudimentary loop in your batch file waiting for that file to delete.

           

           

          Alternatively, though I'm not sure if Monarch does this (I don't use it in batch files), is if Monarch returns an errorlevel on failure. You could check that errorlevel and again if it fails just loop your routine until it's successful.