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!

VB .net no Subreport Data

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

We are loading and exporting a subreport to PDF with the below code, but when it loads the main report data is published but the subreports do not show any records.

If I run the report in Crystal Reports it works perfectly.

Any advice would be appreciated.

Thanks
B

Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
Dim CrReport As New ReportDocument

CrReport.Load(Path)

'logon for main reports
For i As Integer = 0 To CrReport.DataSourceConnections.Count - 1
CrReport.DataSourceConnections(0).SetLogon(gstrUsername, gstrPassword)
Next

'logon for sub reports
For i As Integer = 0 To CrReport.Subreports.Count - 1
For j As Integer = 0 To CrReport.Subreports.Item(i).DataSourceConnections.Count - 1
CrReport.Subreports.Item(i).DataSourceConnections(j).SetLogon(gstrUsername, gstrPassword)
Next
Next


CrDiskFileDestinationOptions.DiskFileName = "c:\temp\exportedreport.pdf"

CrExportOptions = CrReport.ExportOptions

With CrExportOptions

.ExportDestinationType = ExportDestinationType.DiskFile

.ExportFormatType = ExportFormatType.PortableDocFormat

.DestinationOptions = CrDiskFileDestinationOptions

.FormatOptions = CrFormatTypeOptions

End With


CrReport.Export()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top