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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset data not getting displayed 1

Status
Not open for further replies.

mjbosko

Programmer
Jun 26, 2002
248
US
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

'---------------------
 
Quite a dead forum service here... bummer.

Anyway, the solution was to keep the recordset open. That also implies that if you are using a middle tier approach like I am, to keep your connection open. My connection was closing before the report was generated.

To me, this does not appeal as a very good solution, keeping the connection open. In the mean time, I put in a sleepwait function after calling the report so that report has time to get built with the rs before the rs gets closed (aka the connection is given up by the middle tier).

If you are looking to a solution to this, check to see that your recordsets are, indeed, open through the whole process of generating the report.

hth, -m
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top