Send Recordset to CR Sub Report
I use the following code to send Recordset to a CR Main Report:
VB Code:
Option Explicit
Dim Report As New CrystalReport1
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Dim strSQL As String
Screen.MousePointer = vbHourglass
strSQL = "SELECT * " & _
"FROM Table1 " & _
"WHERE Field1 = 'Sales';"
Call GetRS(rs, strSQL)
With Report
.Database.SetDataSource rs
.PaperOrientation = crLandscape
.PaperSize = crPaperLegal
.DiscardSavedData
End With
With CrystalActiveXReportViewer1
.EnableRefreshButton = True
.ReportSource = Report
.ViewReport
End With
Screen.MousePointer = vbDefault
Set Report = Nothing
rs.Close
Set rs = Nothing
MousePointer = 0
End Sub
I have a subreport in this report but I don't want the subreport fetching all of the records in the table and then only displaying the records that I need. I want to know how I can send a recordset to the Subreport?