Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal ActiveX Control or RDC

Posted on 2001-07-30
2
Medium Priority
?
343 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 300 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

688 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