5 Replies Latest reply: May 15, 2014 9:53 AM by lanman00 _ RSS

    Automated export - prompt user for report?

    lanman00 _

      I created the following command to open a report, apply a model and export (append) the table to an existing Access database table...

       

      It's been too many years since I wrote batch files & I can't remember how can I prompt the user to provide the report filename to use in the following batch file? (using Monarch v8.0)

       

      "C:Program FilesMonarchProgramMonarch.exe" /rpt:"c:     estusb010305.txt" /mod:"c:program filesmonarchmodelsusbank1.xmod" /T /exp:"c:/test/BAI_LOAD_TEST2.mdb" /expfileopt:"append" /exptableopt:"append" /exptable:"data"

       

      Thanks for any help...

      LanMan

        • Automated export - prompt user for report?
          Data Kruncher

          Hi LanMan.

           

          Well, it's not very fancy but it should work. Copy and paste the following into Notepad and

          save it as "Run Export.vbs" (include the quote marks and Notepad won't

          add a .txt extension to the file name).

           

          [font="courier"]ReportFile = ""

          do while ReportFile = ""

             ReportFile = inputbox("What is the report name you wish to use (include the full path)? Enter ""exit"" to cancel.")

          loop

           

          if ReportFile <> "exit" then

             "C:Program FilesMonarchProgramMonarch.exe" /rpt:ReportFile /mod:"c:program filesmonarchmodelsusbank1.xmod" /T /exp:"c:/test/BAI_LOAD_TEST2.mdb" /expfileopt:"append" /exptableopt:"append" /exptable:"data"

           

          end if[/font][/quote]That ought do it. Let us know how you make out.

           

          Kruncher

          • Automated export - prompt user for report?
            lanman00 _

            Thanks for the reply.

            but it didn't work...  Error: Expected statement on Line:1 Char: 1

             

            LanMan

            • Automated export - prompt user for report?
              lanman00 _

              Kruncher:

              Your solution worked perfectly... now shoot me because I need to run 3 models against the same datafile in order to capture everything I need for my datbase... how do I modify your code to loop 3 times...

               

              here's my previously working code...

               

              "C:Program FilesMonarchProgramMonarch.exe" /rpt:"c:     estusb010405.txt" /mod:"c:program filesmonarchmodelsusbank1.xmod" /T /exp:"c:/test/BAI_LOAD_TEST2.mdb" /expfileopt:"append" /exptableopt:"append" /exptable:"data"

              pause

              "C:Program FilesMonarchProgramMonarch.exe" /rpt:"c:     estusb010405.txt" /mod:"c:program filesmonarchmodelsusbank2.xmod" /T /exp:"c:/test/BAI_LOAD_TEST2.mdb" /expfileopt:"append" /exptableopt:"append" /exptable:"data"

              pause

              "C:Program FilesMonarchProgramMonarch.exe" /rpt:"c:     estusb010405.txt" /mod:"c:program filesmonarchmodelsusbank3.xmod" /T /exp:"c:/test/BAI_LOAD_TEST2.mdb" /expfileopt:"append" /exptableopt:"append" /exptable:"data"

               

              Thanks again...

               

              LanMan

              • Automated export - prompt user for report?
                Data Kruncher

                All,

                Since I rushed and botched the first "solution" so badly   :rolleyes:   I sent LanMan a private message with revised code to test. Since that worked out well, here is that code, further revised to process the three models as requested.

                 

                [font="courier"]ReportFile = ""

                do while ReportFile = ""

                   ReportFile = inputbox("What is the report name you wish to use (include the full path)? Enter ""exit"" to cancel.")

                loop

                 

                if ReportFile <> "exit" then

                   monarch = """C:Program FilesMonarchProgramMonarch.exe"" "

                   rpt = "/rpt:" & chr(34) & ReportFile & chr(34) & " "

                 

                   model = "/mod:""c:program filesmonarchmodelsusbank1.xmod"" "

                   exports = "/exp:""c:/test/BAI_LOAD_TEST2.mdb"" /expfileopt:""append"" /exptableopt:""append"" /exptable:""data"""

                   domonarch = monarch & rpt & model & exports

                   Set Shell = CreateObject("WScript.Shell")

                   shell.run domonarch, 1, true

                   model = "/mod:""c:program filesmonarchmodelsusbank2.xmod"" "

                   domonarch = monarch & rpt & model & exports

                   shell.run domonarch, 1, true

                   model = "/mod:""c:program filesmonarchmodelsusbank3.xmod"" "

                   domonarch = monarch & rpt & model & exports

                   shell.run domonarch, 1, true

                end if[/font][/quote]Glad to hear that this worked out for you LanMan, and once again, sorry about that first attempt        !

                 

                Kruncher

                • Automated export - prompt user for report?
                  lanman00 _

                  Kruncher:

                  Thanks... perfection...

                  LanMan