Code sample follows...
I have created a report using a ttx file that matches my recordset. In code, I'm calling that report and setting the datasource to the created recordset. debug.print statements show that there are 5 records in the rs, but the report only displays the sample text in my ttx file.
If I call DiscardSavedData then the report is just blank; only showing my header labels. What am I doing wrong? All the examples I see are what I'm doing. Thanks.
'---------------------------
Option Explicit
Dim crAppl As New CRAXDDRT.Application
Dim crRep As CRAXDDRT.Report
Private Sub Form_Load()
Dim cBizRule As clsdbBusinessRules
Dim rptName As String
Set cBizRule = New clsdbBusinessRules
Set rsCR = cBizRule.get_Customers(gUserID)
If Not rsCR Is Nothing Then
If Not rsCR.EOF Then
rptName = PathFix(App.Path) & "RS.rpt"
Set crRep = crAppl.OpenReport(rptName)
' crRep.DiscardSavedData
crRep.Database.Tables(1).SetDataSource rsCR, 3
With CRViewer1
.ReportSource = crRep
.DisplayGroupTree = False
.ViewReport
End With
End If
End If
Set rsCR = Nothing
Set cBizRule = Nothing
End Sub
'---------------------
I have created a report using a ttx file that matches my recordset. In code, I'm calling that report and setting the datasource to the created recordset. debug.print statements show that there are 5 records in the rs, but the report only displays the sample text in my ttx file.
If I call DiscardSavedData then the report is just blank; only showing my header labels. What am I doing wrong? All the examples I see are what I'm doing. Thanks.
'---------------------------
Option Explicit
Dim crAppl As New CRAXDDRT.Application
Dim crRep As CRAXDDRT.Report
Private Sub Form_Load()
Dim cBizRule As clsdbBusinessRules
Dim rptName As String
Set cBizRule = New clsdbBusinessRules
Set rsCR = cBizRule.get_Customers(gUserID)
If Not rsCR Is Nothing Then
If Not rsCR.EOF Then
rptName = PathFix(App.Path) & "RS.rpt"
Set crRep = crAppl.OpenReport(rptName)
' crRep.DiscardSavedData
crRep.Database.Tables(1).SetDataSource rsCR, 3
With CRViewer1
.ReportSource = crRep
.DisplayGroupTree = False
.ViewReport
End With
End If
End If
Set rsCR = Nothing
Set cBizRule = Nothing
End Sub
'---------------------