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

How do you populate sub report using recordset???

Status
Not open for further replies.

tonioJ

Programmer
Oct 7, 2002
90
PH
Hello everyone!

I have a report and almost all of the values are taken from recordset. I am using Field Definition to design my report in Crystal Report 8.5 for ease deployment of the application. I only know how to pass data from recordset to CR with no sub report inside. To pass the values of recordset to report use the code below:

---- sample code start here
dim rs as new ADODB.RECORDSET

rs.open "Select LASTNAME, FIRSTNAME from customer", dbcnn, adOpenStatic, adLockOptimistic, adcmdtext

crpt1.reportfilename = app.path & "\report1.rpt"
Crpt1.SetTablePrivateData 0, 3, rs
Crpt1.action =1

---- end of my sample code

Again, I use the code above to pass the value of recordset to a report with no subreport.

Now, the problem is:
1. How do you pass the value of recordset to subreport of report?
2. Any sample codes for reference?

I need your help badly because I'm running out of time to implement my project. Please help. Thank you in advance.
 
I'm not sure I fully understand your problem. Certainly, you can pass data to a subreport using [Subreport Links] under [Edit] on the menu. Anything passed can then be used within the subreport.
Does this help?

Madawc Williams
East Anglia, Great Britain
 
hello madawc,
yes! i can pass a data in a subreport by using the crystal report program and manually link the sub report to the main report. But this did not solve my problem.
I am developing an application in VB and using the OCX to display the report. The records are retrieved from the SQL Server and pass it to the recordset then from that point, I pass the value of recordset to crystal report using the

Crpt1.SetTablePrivateData 0, 3, rs

command in VB side.

Is there anyway to manipulate the value of subreport on VB side?? Please help. Thank you in advance...


 
Sorry, I don't use VB and can't advise

Madawc Williams
East Anglia, Great Britain
 
Hi,

From the report object you have to get the subreport and do the SetTablePrivateData 0, 3, rs with the subreport object.

Refer to thread766-399956. It has the code both in VB and VC++. There since it is using native SQL server driver, there is a call to SetLogonInfo and SetLocation. You do not have to do that, you have to pass the recordset.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top