Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing table access at runtime

Status
Not open for further replies.

msdavies

Programmer
Feb 21, 2002
1
GB
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top