Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal Reports - Load Report Failed error

Posted on 2006-10-26
10
Medium Priority
?
864 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

670 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