• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2979
  • Last Modified:

Calling Crystal Reports 11 from VB6

I wish to develop a report using Crystal Reports 11 that the end user can then amend to their own requirements.

I have used the VB Crystal Reports control in the past and it seems to work fine with version 6 which was the previous version of Crystal which I had.

I copied the sample Balanch Sheet.rpt from the Crystal reports XI demonstration folder and tried the following:-

Private Sub Command1_Click()
    With CrystalReport1
        .ReportFileName = "C:\TMP\BALANCE SHEET.RPT"
       .Action = 1
    End With
End Sub

When I try to run this I get an error 20525 - cannot run report.

Is there any way round this?

thanks

0
grwallace
Asked:
grwallace
  • 3
  • 2
1 Solution
 
mlmccCommented:
CR XI doesn't support the OCX which is what the code you are using is for.

This page has a lot of help for the new CR XI
http://www.businessobjects.com/products/dev_zone/xiresources.asp

mlmcc
0
 
grwallaceAuthor Commented:
Thanks,

I have looked at this and it would appear that this was the wrong product for my application.

As I have no desire to change the project to vb.net, do you know if I could user CR 10 or even 9 in the way I would like - using the VB6 CR control.

I currently have version 6 which works OK, but I feel I might be missing out on upgraded features by using such an old version.

Gordon
0
 
grwallaceAuthor Commented:
Perhaps we can forget the previous comment - in the documentaton it states that the crystal reports control was discontinued from version 9.

I have looked at the documentation and came up with a document for migrating from the Automation Server to the RDC. It has the following code as an example:-

    Dim CrystalApp As CRAXDDRT.Application
    Dim CrystalReport As CRAXDDRT.Report
    Set CrystalApp = CreateObject("CrystalRunTime.Application")
    Set CrystalReport = CrystalApp.OpenReport("c:\tmp\balance sheet.rpt")

It also states that you must add Crystal Reports Activex Designer for your version in Project/References.

Well, with CRXI the reference is Crystal Reports.Net ActiveX Designer Design & Runtime Library which I added. The code above then becomes:-

    Dim CrystalApp As CRAXDDRT20.Application
    Dim CrystalReport As CRAXDDRT20.Report
    Set CrystalApp = CreateObject("CrystalRunTime.Application")
    Set CrystalReport = CrystalApp.OpenReport("c:\tmp\balance sheet.rpt")

This compiles, but on the first Set statement I get an error 429 - ActiveX Component Can't create object. Any Ideas what I am doing wrong?

Thanks,

Gordon
0
 
mlmccCommented:
If you are using VB6 then you can't use the .Net components.

I don't have CR XI to verify but there should be a CR XI ActiveX Designer Runtime Library

mlmcc
0
 
mlmccCommented:
Glad i could help

mlmcc
0

Featured Post

Independent Software Vendors: 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!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now