1 Reply Latest reply: May 15, 2014 9:54 AM by RalphB _ RSS


    MorseB _

      February 7, 2006


      I am trying to learn how to code for the JetExportTable method.  Below is the Visual Basic code used on a command button on a form in Microsoft Access 2000.


      Monarch executes, opens report and model.  But I am not getting the export to happen.


      Could someone please explain my error?


      Thank you.




      Private Sub cmd_JetExportTable_Click()


      On Error GoTo Err_cmd_JetExportTable_Click


          '02-07-2006 start of dimension variables for jet export table program logic

          Dim monarchobj As Object

          Dim openfile As Boolean

          Dim openmod As Boolean

          Dim t As Boolean

          Dim expfile As String

          Dim stringTableName As String

          '02-07-2006 end of dimension variables for jet export table program logic


          'Verify that the DAFR2261 file that Monarch willl use exists ...

          strname = "     reas_recpt_nt2 ecpt.ftpmainftpdafr2261"

          strexists = Dir(strname)

          If strexists = "" Then

              MsgBox ("File " & strname & " does not exist - Check filename, correct and rerun when file is present ...")

          Exit Sub

          End If


          MsgBox "Monarch will now start and run a script to create the DAFR2261DCCB.mdb data base used in the daily balancing process by RP. Monarch will prompt you for a userid before starting. Your userid is the same as your network userid (durisk, morseb,borsenikc)"


          '02-07-2006 start jet export table program logic

          'If Monarch is currently active GetObject() will use Monarch.  If it is not currently active, use the CreateObject() to open Monarch


          Set monarchobj = GetObject("", "Monarch32")

          If monarchobj Is Nothing Then

          Set monarchobj = CreateObject("Monarch32")

          End If


          t = monarchobj.setlogfile("C:MonTempMPrg_G5.log", False)


          openfile = monarchobj.SetReportFile("     reas_recpt_nt2 ecpt.FTPmainftpDAFR2261", False)


          'open Monarch module

          If openfile = True Then

          openmod = monarchobj.SetModelFile("     reas_recpt_nt2DReconWinMonarchDAFR2261DCCB.mod")


          'set Monarch filter

          If openmod = True Then

          monarchobj.CurrentFilter = "tbl_DAFR2261"


          stringTableName = "tbl_DAFR2261"


          expfile = monarchobj.JetExportTable("     reas_recpt_nt2DImportDataDownloadDafr2261DCCB.mdb", stringTableName, 0)


          End If


          End If





          '02-07-2006 end jet export table program logic



          Exit Sub



          MsgBox Err.Description

          Resume Exit_Command185_Click



      End Sub