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

How to send Recordset data to Crystal reports.

Status
Not open for further replies.

mur3x

MIS
Sep 8, 2003
31
LK
Hi!!, As i'm new to CR i wud be really appreciate if
someone cud sort this out. What i want to do is print
all the data from a Recordset(SQL) to a Crystal report.
I use CR8.5

Infact to make things simple i have the below code
which can print from recordset to 'VB DataReport'..

Code:
Private Sub cmdprint_Click()

With rptdynamic 				'datareport
  Set .DataSource = Nothing
            .DataMember = ""
  Set .DataSource = rsdyn.DataSource	   'recordset-rsdyn
       With .Sections("Section1").Controls
	    For i = 1 To .Count
               If TypeOf .Item(i) Is RptTextBox Then
                      .Item(i).DataMember = ""
                      .Item(i).DataField = rsdyn.Fields(i - 1).Name
	       End If
            Next i
        End With
  .Show
End With
    
End Sub


thnx!!
Mur.
 
thanx!!! a good read..
well as for my problem i found out another way.
i post it for the benefit of others.

'recordset gets date from form1 where 2 DTpicker controls populate a datagrid. form2 is where the the CRviewer control is located

Code:
Dim Report As New CrystalReport1



sub form_load

rs.Open "select id,code,date from receipts where date between #" & Format$(Form1.DTPicker1, "mm/dd/yy") & "# and #" & Format$(Form1.DTPicker2, "mm/dd/yy") & "#" & "order by date", cn, adOpenKeySet

Report.DiscardSavedData
Report.Database.SetDataSource rs, 3, 1

CRViewer1.ReportSource = Report
CRViewer1.ViewReport

end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top