Solved

Crystal Reports - Load Report Failed error

Posted on 2006-10-26
10
855 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
Industry Leaders: 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 500 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

Independent Software Vendors: 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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 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