Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Reports - Load Report Failed error

Posted on 2006-10-26
10
Medium Priority
?
866 Views
Last Modified: 2008-01-09
VS Studio 2005 Professional
Windows Forms

I am in the process of releasing an application for sale.  I have created the setup files for the application with prerequisites included.  I followed the BusinessObjects instructions on adding a merge module into my setup.  Very straightforward.  I added the file 'CrystalReportsRedist2005_x86.msm' which in turn added the files 'Microsoft_VC80_ATL_x86.msm' & 'policy_8_0_Microsoft_VC80_ATL_x86.msm' under Dependencies.  I have executed the program where I am using the following:

VB 2005
SQL Server 2005 Express
Crystal Reports for VB 2005

I ran the setup.exe where it installed all of the above and am able to perform all functions I want within my app except running a CR report.  I'm getting the error below about not being able to find a file.  I have embedded CR reports in the application.  I originally had a path included as shown below where I've commented it out but I took it out prior to re-building my executable.

Error I received........
System.Exception: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the file specified.


Imports CrystalDecisions.CrystalReports.Engine

Public Class ReportView
    Private Sub ReportView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim docReport As New ReportDocument
        '' Commented !!       docReport.Load(glRootDirectory & glReportName)
        docReport.Load(glReportName)
        docReport.SetDataSource(dtReport)
        CrystalReportViewer1.ReportSource = docReport
    End Sub
    Private Sub Form_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        CloseForm()
        glReportName = ""
    End Sub
End Class


I am completely oblivious to the problem.  And to make it worse I was going to install my program today at a customer site.

Please help...Thanks!
Phil Tate
0
Comment
Question by:TSFLLC
  • 6
  • 4
10 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17813693
Hi TSFLLC,

> I have embedded CR reports in the application.

You cannot use the Load method with an embedded report. The Load method can only be used when you ship .rpt files with your application.

You need to change:
Dim docReport As New ReportDocument

For:
Dim docReport As New YourReportName


Cheers!
0
 

Author Comment

by:TSFLLC
ID: 17813869
Eric,

Dim docReport as New WHAT = YourReportName  ?

Phil
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17813966
Your report as a name when you look at it in the solution explorer. This name is also the name the report class. You need to use this name to create an instance of it.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17814001
0
 

Author Comment

by:TSFLLC
ID: 17814021
I just found a BusinessObjects file on this as you were posting your next post.  I understand what you are doing now.

If you notice in my first post, I have a global variable that contains the file name.  Do I have to create a Case statement with all of my reports and set a Dim docReport as .... for each of them or is there a way to continue using glReportName where this would not be necessary.  I realize that glReportName has been populated with 'ReportName.rpt' and would need to be Changed to 'ReportName()'...or something like that.  Needless to say 'Dim docReport as New glReportName gives me a 'type not found' error.

Is this possible?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17814055
>>Do I have to create a Case statement with all of my reports and set a Dim docReport as .... for each of them

Yes.

Personnaly, I prefer to distribute the reports as external file. This way, I can modify any report, redistribute it without having to recompile the application.
0
 

Author Comment

by:TSFLLC
ID: 17814110
That was going to be my next question.....distribute them or not?     OK!

And if I do distribute them, I don't have to change anything in my original code?  Just make sure that my docReport.Load points to the appropriate path of the reports?

0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 17814180
Nothing to change. You keep your Load method and your variable.
0
 

Author Comment

by:TSFLLC
ID: 17814231
I just tested it and it worked.

Last question, and I think I know the answer but it will be easier to ask before testing.

In terms of the inclusion of reports, I just create a folder under my Setup project and add all of the reports into that Setup project folder.  When I perform the setup of the application, it will create the 'Reports' folder with all of the reports I included in the Setup project?


An eighteen month project finished!!! Time to make some money now.

Thanks for everything Eric.

Phil
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 17814285
>>When I perform the setup of the application, it will create the 'Reports' folder with all of the reports I included in the Setup project?

It should.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question