on 07-14-2008 3:14 PM
First, some specifics about software versions.
Windows XP SP2
VB6 SP6
CR 8.5 (8.5.3.975)
CR XI Release 2 (11.5.8.826)
Background
We have a legacy VB6 app that runs on government owned computers (our contract mandates that we use VB6 and not VB.net). The application is designed to be stand-alone and uses MS Access mdb fles for data storage. There are about a dozen Crystal reports that were designed in CR8.5 and are installed with the application as external rpt files. Within the application, we use the CR8.5 report viewer to call up whichever report the person wants to see and all was working well. Then came that dreadful day that brought the request to upgrade to CRXI.
I had been using CRXIr2 in a seperate ASP.net application, so I am familiar with it's .net methods and such. However, the ASP.net development was done using a different computer. The problems began when I installed CRXIr2 on the VB6 development computer.
Problems
When ever I open VB6 or CRXIr2, I get a dialog box saying windows need to configure CRXIr2 (a process that takes about 10 minutes and occasionally asks for a reboot). It seems to try and run a file called java.exe (found in c:\program files\business objects\j2sdk1.4.2_08\bin) 3 times before it finally drops me into VB or CR. Crystal 8.5 still opens with out any issue, if that helps.
The application presents the user with a form that has a list box and a toolbar. The user selects the report they want to view from the list box, then clicks on the tool bar that has an option to (among other things) print the report, or preview it. When previewing, the form opens a second form that has the CR8.5 viewer embeded in it. The report selection form passes the report name and location to the viewer form, as you will see in the code below.
First, here is the code for the report selection form that sets up the viewer (the PrintOption variable is passed by the button click event and merely tells the sub that we're wanting to preview the report, or print it to the screen rather than a printer):
Public Sub PrintReports(PrintOption As ePrintOption)
Dim oCRApp As CRAXDRT.Application
Dim oCRReport As CRAXDRT.Report
Dim oCRDatabaseTable As CRAXDRT.DatabaseTable
Dim s As String
Dim sReportName As String
Dim i As Integer
On Error GoTo Error
'show app busy
Screen.MousePointer = vbHourglass
'create instance of crystal report
Set oCRApp = New CRAXDRT.Application
'determine which report is selected
For i = 0 To Me.lstReports.ListCount - 1
If Me.lstReports.Selected(i) = True Then
'get name of the report
sReportName = Me.lstReports.List(i)
'open report
Set oCRReport = oCRApp.OpenReport(App.Path & "\Reports\" & sReportName & ".rpt", 1)
'set login information for report
For Each oCRDatabaseTable In oCRReport.Database.Tables
If sReportName = "Bank of America Transfer" Then
oCRDatabaseTable.SetLogOnInfo App.Path & "\Data\sgtlog.mdb", "", "Admin", ""
Else
oCRDatabaseTable.SetLogOnInfo App.Path & "\Data\sgt.mdb", "", "Admin", ""
End If
'test report connectivity to the database
If oCRDatabaseTable.TestConnectivity = False Then
MsgBox "You do not have the appropriate access " &_
"permissions to print or preview this report. " & _
"Please contact your network administrator to " &_
"give you Full Control permissions to " & _
"the application folder below: " & vbCrLf & vbCrLf & _
App.Path, vbInformation + vbOKOnly
Screen.MousePointer = vbNormal
Exit Sub
End If
Next
'assign report form fields for those required reports
Select Case sReportName
Case "Voucher Form"
Call Me.FilloutVoucher(oCRReport)
If Me.CancelAction = True Then
Screen.MousePointer = vbNormal
Exit Sub
Else
Me.CancelAction = False
End If
Case "Dispute"
Call Me.FilloutDisputeForm(oCRReport)
Case "Transfer"
Call Me.FilloutTransfer(oCRReport)
End Select
'assign report title of the report to the name of the report
oCRReport.ReportTitle = sReportName
'determin whether to print or preview report
If PrintOption = ToPrinter Then
Call oCRReport.PrintOut(False)
Else
Call Load(frmReportViewer)
Call frmReportViewer.ViewReport(oCRReport)
Screen.MousePointer = vbNormal
Call frmReportViewer.Show(vbModal)
End If
End If
Next
'memory management
Set oCRApp = Nothing
Set oCRReport = Nothing
Set oCRDatabaseTable = Nothing
'show app normal
Screen.MousePointer = vbNormal
Exit Sub
Here's the code from the report viewer form:
Option Explicit
Private ActiveReport As CRAXDRT.Report
Public Sub ViewReport(Report As CRAXDRT.Report)
'------------------------
'assign report
'------------------------
Set ActiveReport = Report
'------------------------
'set report options
'------------------------
Me.crViewer.DisplayGroupTree = False
Me.crViewer.DisplayTabs = False
Me.crViewer.DisplayToolbar = True
Me.crViewer.DisplayBorder = False
Me.crViewer.DisplayBackgroundEdge = False
Me.crViewer.EnableExportButton = True
Me.crViewer.EnableCloseButton = False
'------------------------
'assign the report
'------------------------
Me.crViewer.ReportSource = Report
'------------------------
'show report
'------------------------
Call Me.crViewer.ViewReport
End Sub
Attempts to Correct
This code is for the CR8.5 viewer and it works. When I replace the CR8.5 viewer control with the CRXIr2 viewer control (using the "Add CrystalReports 11.5" function found on the "Project" menu), the code still works. However, when I replace the CR8.5 dll's (crviewer.dll and craxdrt.dll) with their CRXIr2 versions, I suddenly get an error message: Error 429 - ActiveX Cannot Create Object.
On top of that, if I remove the reference to CR8.5 in the project properties, the application will no longer compile or run and gives me an error stating
User-defined type not defined
on every line that references CRAXDRT.Report.
I have yet to find a good reference document for using CRXIr2 on either the Business Objects site or using Google to perform a general search of the web. I've also found conflicting reports about wether or not CRXIr2 even works with VB6.
Cry for Help
Can someone either point me to a good reference document for using CRXIr2 with VB6, or point out where I'm going wrong in my conversion process? I'd greaty, greatly appreciate either one.
Thank you for your time.
Edited by: Scott Simpson on Jul 14, 2008 4:16 PM - Formatting for readability
Edited by: Scott Simpson on Jul 14, 2008 4:18 PM - Formatting for Readability
CR XI Release 2 Report Designer Component (RDC, the craxdrt.dll) works with VB6.
That you get a dialog box that tries to configure Crystal Reports every time you open it suggests a broken/incomplete installation.
What happens if you uninstall CR XI Release 2, and re-install using the local administrator account?
Sincerely,
Ted Ueda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seems the uninstall/reinstall worked (though it did take quite some time to find where to download CRXIr2). Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the quick response, Ted!
I installed from the CRXI cd's that I have, and then downloaded the SP from Business Objects to get to CRXIr2. Is there a way to skip the CRXIr1 install and (after uninstalling CRXI) jump right to CRXIr2?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.