Thursday, March 8, 2012

Crystal Report Database Path question

VB 6 Enterprise Edition; Crystal Report XI Developer Edition

I don't understand, did I phrase my previous question wrong?

Let me restate it:

From a VB 6 application, how do you code to tell Crystal Reports where the database tables are located?

This is the code I use to get the report(s)
Set craxreport = craxapp.OpenReport(App.Path & "\" & ReportName)
craxreport.DiscardSavedData
CrystalActiveXReportViewer1.Refresh
CrystalActiveXReportViewer1.ReportSource = craxreport
CrystalActiveXReportViewer1.ViewReport
Set craxreport = Nothing
SamProblem Resolved:
Here is the code in case anyone needs it:

Dim dbTable As CRAXDDRT.DatabaseTable
Set dbTable = craxreport.Database.Tables(1)
craxreport.DiscardSavedData
dbTable.Location = App.Path & "\BOM.mdb"
CrystalActiveXReportViewer1.Refresh
Call CrystalActiveXReportViewer1_RefreshButtonClicked(True)
CrystalActiveXReportViewer1.ReportSource = craxreport
CrystalActiveXReportViewer1.ViewReport
Set craxreport = Nothing

No comments:

Post a Comment