Solved

Crystal ActiveX Control or RDC

Posted on 2001-07-30
2
321 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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 …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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