Here is an example:
Private Sub CrystalSetDataSource()
Dim i, j As Integer Dim Subreport As CRAXDRT.Report
'Set table properties in main report Call CrystalSetTableProperties_QuickBooks(g_crReport)
'Set table properties in all subreports With g_crReport For i = 1 To .Sections.Count For j = 1 To .Sections(i).ReportObjects.Count If (.Sections(i).ReportObjects(j).Kind = crSubreportObject) Then Set Subreport = .OpenSubreport(.Sections(i).ReportObjects(j).SubreportName) Call CrystalSetTableProperties_QuickBooks(Subreport) End If Next j Next i End With
End Sub
Private Sub CrystalSetTableProperties_QuickBooks(Report As CRAXDRT.Report)
'Set QuickBooks connection properties With Report.Database.Tables.Item(1) .ConnectionProperties.DeleteAll .ConnectionProperties.Add "DSN", g_vcDSN_QuickBooks End With
End Sub
There a a few constants and variables that would need to be changed for your own use, hopefully they are evident enough.
|