Solved

Crystal Reports - Load Report Failed error

Posted on 2006-10-26
10
852 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 69

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 69

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
 
LVL 69

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 69

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 69

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 69

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now