Solved

Updating from Crystal Reports 8.5 to 10

Posted on 2006-11-30
2
466 Views
Last Modified: 2012-08-14
I have some legacy code which needs to be upgraded due to the changes made to crystal reports controls in the vb6 IDE
I was using crystal 8.5 which supplied a crystal32.ocx control and has worked fine.
We are upgrading our reports to crystal reports v10 and low and behold the crystal32.ocx  is no longer supported.

Firstly - do i have to use crystal designer? I would prefer not to embed the reports.
Can I dynamically load a report into an object and hand it to CrViewer? If so what is this object called?

the follow are the methods I use with the  crystal32.ocx control
1)  .DataFiles(0) = strBeerDataBase
2)  .ReportFileName = strReport_Path
3)  .SelectionFormula =  CriteriaCreator()
4)   .Action = Open
what are the equivelant in crystal reports v10 vb6 IDE objects
Cheers T
0
Comment
Question by:visualbasic
[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 1

Accepted Solution

by:
weiroblpay earned 125 total points
ID: 18048928
Note:  I'm using Crystal 11, but I believe it's the same for 10
Here's some code I use to connect a report file (that I designed in Crystal and saved as a .rpt):

VB References:  
Crystal Reports Active X Designer
Crystal Reports Active X Designer Run Time Library  (craxdrt.dll)

Components:
Crystal Active X Report Viewer Library (crviewer.dll)

This code is in a class that works with reports

Dim crxTable As CRAXDRT.DatabaseTable
Dim m_crxApp As CRAXDRT.Application
Dim m_crxReport As CRAXDRT.Report
' m_strDSN holds the name of the system DSN that connects to the database - there may be a better way to connect the report, but this
' allows me to develpe the report using a development DB and run the report on a production system that may use a different DB name
' m_strDBName holds the name of the database - the Initial Catalog -
' m_strUID holds the userID needed to logon to the SQL database
' m_strPWD holds the password to log on to the database

' setup for SQL server
      Set m_crxApp = New CRAXDRT.Application
      ' log on to the server - if we don't do this here, the report can't be viewed
      m_crxApp.LogOnServer REPORT_DLL, m_strDSN, m_strDBName, m_strUID, m_strPWD
      ' open report object
      If Right$(ReportFile, 1) <> "\" Then
         strReportAndPath = m_strReportPath & "\" & ReportFile
      Else
         strReportAndPath = m_strReportPath & ReportFile
      End If
   
      Set m_crxReport = m_crxApp.OpenReport(strReportAndPath, 1)
      ' set each table to the correct DSN, DB, UID and PWD
      ' this is different for SQL databases - this allows us to use different
      ' settings than originally stored in the report
      For Each crxTable In m_crxReport.Database.Tables
         crxTable.SetLogOnInfo m_strDSN, m_strDBName, m_strUID, m_strPWD
      Next crxTable

' NOTE:  frmReports is a form with the crviewer.dll supplied control for previewing reports.
   Set m_frmRpt = New frmReports
   Load m_frmRpt
   m_frmRpt.Caption = "View Report"
   m_frmRpt.rptView.ReportSource = m_crxReport
   m_frmRpt.rptView.Visible = True
   m_frmRpt.rptView.ViewReport
   m_frmRpt.Show


For Access type databases, you could use this code instead:

'       open crystal app object to setup report
      Set m_crxApp = New CRAXDRT.Application
      ' open report object
      If Right$(ReportFile, 1) <> "\" Then
         strReportAndPath = m_strReportPath & "\" & ReportFile
      Else
         strReportAndPath = m_strReportPath & ReportFile
      End If
      Set m_crxReport = m_crxApp.OpenReport(strReportAndPath, 1)
      ' make sure each table in the report points to the correct database ....
      ' this will allow you to use any name for the database, instead of just the
      ' one that was saved with the report file - and allow us to store the reports
      ' anywhere we want instead of in the same folder with the database.
      For Each crxTable In m_crxReport.Database.Tables
         crxTable.Location = m_strDBName
      Next crxTable

' NOTE:  frmReports is a form with the crviewer.dll supplied control for previewing reports.
   Set m_frmRpt = New frmReports
   Load m_frmRpt
   m_frmRpt.Caption = "View Report"
   m_frmRpt.rptView.ReportSource = m_crxReport
   m_frmRpt.rptView.Visible = True
   m_frmRpt.rptView.ViewReport
   m_frmRpt.Show

Hope this helps.

Ron
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18063894
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 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