Solved

Updating from Crystal Reports 8.5 to 10

Posted on 2006-11-30
2
465 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 100

Expert Comment

by:mlmcc
ID: 18063894
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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