Solved

Crystal ActiveX Control or RDC

Posted on 2001-07-30
2
331 Views
Last Modified: 2012-08-14
I'm using CR8 reports against an SQL Server 7 database.
Our Visual Basic application has drop-down menus of about 30 different reports to launch.
Our reports are stored on the server; they won't need any parameters passed to stored procedures.
Ideally, I would like to pass the name of the report and then launch the correct crystal report.
Originally, our application had about 30 crystal report controls dragged onto the form FOR EACH different report.
I found that this slowed down the launching of our main form.
Can someone tell me - what is my best option to correct the "multiple controls on the form" problem?
I started rewriting the code and found that with CR8, a lot of people recommend using the RDC - Report Designer Component.
Do I need to use this or could I stay with the ActiveX Control (crystl32.ocx)?

Thanks in Advance
John
0
Comment
Question by:jtrapat1
[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
2 Comments
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 100 total points
ID: 6336604
If you are trying to minimize code size, skip the RDC.  Your reports, if you follow the Crystal Decisions company line, become a part of your project (and therefore, your executable).

Make a single instance of a form containing a Crystal Report Viewer control (part of the new libraries) and create and destroy it as you go.  If you are not passing parameters, you should be able to get away with a single form being created/destroyed by a public sub that takes the report file name as a parameter.

I would move away from the OCX control and use the new viewer control, but keep using the external report designer to make standalone .RPT files instead of using the designer integrated into the IDE.

DRRYAN3
0
 
LVL 2

Expert Comment

by:chandukb
ID: 6340615
Hi,

I used to use Crystal OCX for my applications, This worked fine but we realized that this opens a new connection to the database(LongOnServer method).  So, I converted my app to RDC(Crystal Viewer Control) and it works great.

This is my code and it works.  It doesn't open a new connection, it uses the existing global connection
to fill the recordset and calls the CRViewer form to show the report.  Hope this helps.

Public Sub ShowReport(lstrReportName As String, lstrReportDataTable As String,                      
 lstrReportSql As String, lstrReportWhere As String)

Dim lrsReportData As ADODB.Recordset
Dim CRVAppl As CRAXDRT.Application
Dim CRReport As CRAXDRT.Report

Debug.Print lstrReportSql, lstrReportDataTable, lstrReportWhere

'I am getting data in to the recordset based on the user
criteria SQL, replace with your own recordset
Set lrsReportData = gDAS.GetRecordsetView(lstrReportSql, lstrReportDataTable, lstrReportWhere, "")


If lrsReportData.RecordCount > 0 Then
 
  Set CRVAppl = New CRAXDRT.Application
  Set CRReport = CRVAppl.OpenReport(gstrReportDirectory & lstrReportName)

  With CRReport
      .DiscardSavedData
      .Database.Tables(1).SetDataSource lrsReportData, 3
      .ReportTitle = lstrReportName
  End With
 
  With frmReportViewer1
      .CRViewer.ReportSource = CRReport
      .CRViewer.ViewReport
      .Show
  End With
     
Else
  MsgBox "The Report could not be generated ", vbOKOnly +  vbExclamation, "No Records Found"
  Exit Sub
End If

End Sub


Chandu
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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