Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2004, 03:37 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can Main and SubReport get data fr different table

I would like to check if a report
consisting of a main report and a subreport
can get data from different tables? My
report is only displaying correctly for
main report and the subreport only have
fld1, fld2, fld3 (all three fields from
Table1)displaying correctly, and fld4 (from
Table2) is empty. Can anyone help, please?
Thanks in advance.

Dim rsBor As ADODB.Recordset
rsBor = New ADODB.Recordset
Dim cmd As ADODB.Command
cmd = New ADODB.Command
cmd.let_ActiveConnection(cnn)
With cmd
.CommandText = "Select fld1, fld2,
fld3, ...from Table1"
.CommandType =
ADODB.CommandTypeEnum.adCmdText
.CommandTimeout = 15
End With

End If
rsBor = cmd.Execute



Dim rsBor1 As ADODB.Recordset
rsBor1 = New ADODB.Recordset
Dim cmd1 As ADODB.Command
cmd1 = New ADODB.Command
cmd1.let_ActiveConnection(cnn)
With cmd1
.CommandText = "Select fld1, fld2, fld3,
fld5 ...from Table1 join Table2"
.CommandType =
ADODB.CommandTypeEnum.adCmdText
.CommandTimeout = 15
End With

End If
rsBor1 = cmd1.Execute


Dim PrintOne As New CRMainReport
PrintOne.SetDataSource(rsBor)

Dim crxSubreport1 As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
crxSubreport1 = PrintOne.OpenSubreport
("subrep1.rpt")
crxSubreport1.SetDataSource(rsBor1)

PrintOne.PrintToPrinter(1, False, 0, 0)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with CrossPage Postback to Display Data fr cyberstore05 ASP.NET 2.0 Basics 0 September 7th, 2008 04:29 PM
where to call subreport from main lisabb Access 2 October 31st, 2007 05:54 AM
Passing parameters from main report to subreport Swati_Jain Crystal Reports 0 May 24th, 2006 09:04 AM
supress pageheader of main report in subreport padma_eedara Crystal Reports 0 January 27th, 2006 09:07 AM
Subreport not displaying no data message in main lic023 Access 0 March 15th, 2005 08:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.