This example does not seem to be relavent - I need to load RPT files into my app at runtime! Can this be done?
Main Topics
Browse All TopicsHey there
I am having a hard time trying to figure out how to load in external report files (that reside in a folder on the same computer as the application) into the Crystal Report Viewer ActiveX control. I have seen examples of how to do this in the legacy control thats provided, but I need to use the new crviewer.dll control. Basically I just need to know how to tell my CRViewer object (in VB6) to load "c:\testreport.rpt" and then show it in the control.
I will also need to specify a different query for the report as I need to filter data that appears on the report.
Hope you can help!
Matt.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I am using Crystal Reports Developer Version 8.5 to create the report files and save them to disk. When I installed developer edition, I got the active X viewer. (CRVIEWER.DLL). Added this to my project and tried embedding the report like sample frodoman pointed me at. This is totally pants in that I cant seem to get the report even working without installing SQL Sever Client Connectivity tools (from the SQL Server 2000 install cd) and also the DSR file retains information about the IP address of the sql server. When the project is moved to the customers site, the IP its looking at is wrong, of course.
I have tried using SetLogonInfo for each table in the Report.Tables() collection, but this does NOT work. I even checked subreports were getting changed to the right IP - and tried removing them.
Therefore, the only, and better way to do this is to get CRVIEWER to swallow its pride and take .RPT files that are not embedded, but located in a folder somewhere. This needs to be done at run time. The does not need to edit the report from within my host application, it should just get the report layout from a RPT file, which we could change at a later date without changing the application binary.
This seems like something that would be supported, I just cant find any methods to do it.
Again, the RPT file needs to be accessed at RUNTIME, and it is NOT embedded into a DSR file and compliled with the app.
Hope you can help guys, thanks for your help so far!
Well, this appears to load the report, but its coming up with Server Not Yet Opened! The report is set to use ODBC if that matters..
'SQL-MIS' is the System DSN.
Code:
Dim CrxApp As New CRAXDRT.Application
Dim CrxRpt As CRAXDRT.report
Private Sub Form_Load()
'// load the report up
Set CrxRpt = CrxApp.OpenReport("H:\Sour
CRViewer1.ReportSource = CrxRpt
Dim intTableID As Integer
For intTableID = 1 To CrxRpt.Database.Tables.Cou
CrxRpt.Database.Tables(int
Next
CRViewer1.ViewReport
CrxRpt.SQLQueryString = "SELECT [R&D_MIS].dbo.tbl_system.*
Screen.MousePointer = 11
Do
DoEvents
Loop While CRViewer1.IsBusy
CRViewer1.Refresh
Screen.MousePointer = 0
End Sub
This is a common error message. Business objects provides a doc specifically for trouble-shooting this situation:
http://support.businessobj
Business Accounts
Answer for Membership
by: frodomanPosted on 2004-02-06 at 05:53:05ID: 10289687
I recommend you download this file. This is a beginner-level application example for calling external reports with VB.
ects.com/c ommunityCS / FilesAndU pdates/sim pledemo.zi p.asp
http://support.businessobj