I think this as simple as a typo this time.
Change your [font="courier"]monarch.obj.PrintTable (True) /font[/quote]to [font="courier"]monarchobj.PrintTable (True)[/font][/quote]without the first period.
There was an error posted in 2004 relating to using PrintTable with database sources, but that doesn't seem to be the case here.
Corrected the period. However, it still did not run.
So I tried using summary and getting no where. The report comes up but I never it see it go to table or summary view.
Revised code below:
Private Sub cmd_100_400_Balance_Click()
Dim monarchobj As Object
Dim openfile As Boolean
Dim openmod As Boolean
Dim t As Boolean
Dim expfile As Boolean
Dim stringTableName As String
Dim stDocName As String
Dim strname As String
Dim stappname As String
Dim db As Database
Set db = CurrentDb
Dim ImportRecordSet As Recordset
'02-16-07 changed message
MsgBox "Monarch will now start and print 100 & 400 balancing report."
'If Monarch is currently active GetObject() will use Monarch. If it is not currently active CreateObject()will open Monarch
Set monarchobj = GetObject("", "Monarch32")
If monarchobj Is Nothing Then
Set monarchobj = CreateObject("Monarch32")
t = monarchobj.setlogfile("C:MonTempMPrg_G5.log", False)
openfile = monarchobj.SetReportFile("Treas_recpt_nt2dImportDataDownload107_JPMC_Access_Dailydailyfile.dat", False)
'open Monarch module
If openfile = True Then
openmod = monarchobj.SetModelFile("Treas_recpt_nt2dReconWinMonarchX-ModsJPMC_Access_Daily-bal_$_Cnt.xmod")
'set Monarch filter
If openmod = True Then
monarchobj.CurrentFilter = "100_400"
monarchobj.CurrentSummary = "100_400"
Beth PM'd me the other day and indicated that there was an error in the model file path, and that was the only error. All was well when the path was corrected.
Sorry, forgot to post back here.
This is a good example of why you should always use an ELSE when checking the success or failure of operations. The SetModelFile failed and the program just silently carried on to close Monarch.
Actually, I check if the Open has failed and raise an error as such:
'Raise Error if File Open failed
If OpenFile = False Then
sProblem = "Error Opening File: " & sReportFile
Err.Raise vbObject + ReportErr, "Monarch", sProblem
End If[/font][/quote]But that's just me.