I have been trying to run a report, designed in the RDC (i.e. a *.rpt file), called from a VB app in the following way:
Dim oCrystalReport As CRAXDRT.Report
Dim oCrystalApp As New CRAXDRT.Application
Dim frmRpt As frmReport
Set frmRpt = New frmReport
Set frmRpt.Report = oCrystalApp.OpenReport(App.Path & "\MyReport.rpt"
Set oCrystalReport = frmRpt.Report
'Get data
createPMsReportData
oCrystalReport.Database.Tables(1).SetTableLocation m_sMyReportCrosstabTableName, "", ""
oCrystalReport.Database.Verify
The trouble is that the report (MyReport.rpt) has a hard-coded location and alias (as Crystal enforces it). At runtime, the SetTableLocation function successfully updates the 'Location' attribute to the supplied value. However, the 'Name' attribute for that table stays set to the same hard-coded name set in the MyReport.rpt file, and the report then complains that it cannot read the table (with the hard-coded name), as I dropped it. I want the report to run off the tables created at runtime.
Is there anything I have missed in the code, or is there a setting in the report that I should set to achieve this?
Thanks in advance for any help.
Regards,
Matthew.
Dim oCrystalReport As CRAXDRT.Report
Dim oCrystalApp As New CRAXDRT.Application
Dim frmRpt As frmReport
Set frmRpt = New frmReport
Set frmRpt.Report = oCrystalApp.OpenReport(App.Path & "\MyReport.rpt"
Set oCrystalReport = frmRpt.Report
'Get data
createPMsReportData
oCrystalReport.Database.Tables(1).SetTableLocation m_sMyReportCrosstabTableName, "", ""
oCrystalReport.Database.Verify
The trouble is that the report (MyReport.rpt) has a hard-coded location and alias (as Crystal enforces it). At runtime, the SetTableLocation function successfully updates the 'Location' attribute to the supplied value. However, the 'Name' attribute for that table stays set to the same hard-coded name set in the MyReport.rpt file, and the report then complains that it cannot read the table (with the hard-coded name), as I dropped it. I want the report to run off the tables created at runtime.
Is there anything I have missed in the code, or is there a setting in the report that I should set to achieve this?
Thanks in advance for any help.
Regards,
Matthew.