all groups > visual studio .net general > july 2007 >
You're in the

visual studio .net general

group:

VB.net Issues with Crystal Reports Exporting Only Once


VB.net Issues with Crystal Reports Exporting Only Once martybruce NO[at]SPAM gmail.com
7/23/2007 1:19:31 PM
visual studio .net general:
I'm having an issue calling crystal reports 10 within vb.net 2003

I can call the report and print the report all day long.

The issue occurs when I choose to export the report. Works like a
champ the first time... everything exports great. But once the user
has exported, they are no longer able to run reports (print, export,
or even view)

It is almost like once the report has been exported the predefined
cache is full and can't clear....

Any Ideas?

The message that is given is:

An unhandled exception of type 'System.Exception' occurred in
crystaldecisions.crystalreports.engine.dll

Additional information: Load report failed.

Here is a snipet of my code:


'Load Crystal Report
Public Sub LoadCR(ByVal ds_Gview4 As DataSet, ByVal rptpath As
String, ByVal ds_TotRev As DataSet, ByVal Loc As String)

myrpt = rptpath
totRev = ds_TotRev
Dim CReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument

'Load Agency and Module Name
Dim CRText As Engine.TextObject
Dim CRText2 As Engine.TextObject
Dim CRText3 As Engine.TextObject

CReport.Load(myrpt)
If myrpt <> "GLLoadFile.rpt" Then
CRText =
CType(CReport.ReportDefinition.ReportObjects("txtAgency"),
Engine.TextObject)
CRText2 =
CType(CReport.ReportDefinition.ReportObjects("txtModule"),
Engine.TextObject)
CRText3 =
CType(CReport.ReportDefinition.ReportObjects("txtLocation"),
Engine.TextObject)

CRText.Text = globalclass.orgnam
CRText2.Text = globalclass.selmod
CRText3.Text = Loc
End If

CReport.SetDataSource(ds_Gview4.Tables(0))
'Only use on the IncomeStatement for Total Revenue
If IncomeState.rptflg = True Then
'CReport.SetDataSource(totRev.Tables(0))
If myrpt = "IncomestateForecast.rpt" Then

CReport.Database.Tables("glmodbal").SetDataSource(totRev.Tables(0))
End If

CReport.Database.Tables("glbalance").SetDataSource(ds_Gview4.Tables(0))
Else
CReport.SetDataSource(ds_Gview4.Tables(0))
End If

CRViewer.ReportSource = (CReport)
End Sub
Re: VB.net Issues with Crystal Reports Exporting Only Once martybruce NO[at]SPAM gmail.com
9/11/2007 10:50:28 AM
[quoted text, click to view]

This is with VisualStuido 2003 (Windows vb.net app) using Crystal
Reports 10


Here is the solution to this annoying issue...

If you use the actual path to the .rtp file instead of the relative
path... it works like a champ. I'm still not sure why it works fine
until you export once...

So if you use C:\reports\mytest.rpt as the path, instead of
mytest.rpt (which should work if it is in the same folder as your
executable)

Then you can export as many time as you want.
AddThis Social Bookmark Button