Solved

Crystal ActiveX Control or RDC

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now