Solved

Crystal ActiveX Control or RDC

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

713 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