Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

How I get call cr10 from VB6 by code

I have VB6 with CR10 and I need to know how I could call my reports.
by other words
before with CR6 I was using "Crystal Report Control" from Components and recall the report by the property of (.Reportfilename).

I don't know which Component with CR10 has to be installed and what the code should be writtten.

please advice

Thanks

Mostafa
0
Mostafa_ElSadek
Asked:
Mostafa_ElSadek
  • 4
  • 4
1 Solution
 
JohnBPriceCommented:
In XI, which should be similar to 10, You have some different options, but for the ActiveX viewer in standard windows, you need to
Add a component to your project "Crystal ActiveX Report Viewer Library 11.0" (you would use 10.0)
Add a reference to your project "Crystal Reports ActiveX Designer Design and Runtime Library 11.0"

put the viewer control on a form

then in code do (the control is named CRViewer)

Dim xtal As New CRAXDDRT.Application
Dim rpt As Report

    Set rpt = xtal.OpenReport("The path and file name of your saved report")
    rpt.ReadRecords
    CRViewer.ReportSource = rpt
    CRViewer.ViewReport

0
 
mlmccCommented:
I would recommend you use CRAXDRT.dll.  CRAXDDRT has more functionality but some of the functionality requires you to provide (read purchase) runtime license for each user.  In general the CRAXDRT has all the power you need.

The Crystal controls you used in CR6 have been repplaced by new controls to take advantage of new technology.

I use similar code
Dim xtal As New CRAXDDRT.Application
Dim rpt As Report

    Set rpt = xtal.OpenReport("The path and file name of your saved report")

    CRViewer.ReportSource = rpt
    CRViewer.ViewReport

Do you need to pass any informatiion from the application to the report?

mlmcc
0
 
mlmccCommented:
Which edition of Crystal 10 do you have?  You need the Developer or Advanced edition to run reports from VB6.

mlmcc
0
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!

 
Mostafa_ElSadekAuthor Commented:
I'm using CR10 Product Type: Full , Product version : 10.0.0.533
thanks

Mostafa
0
 
Mostafa_ElSadekAuthor Commented:
I tried the above code but it gave me an error message with this line :

Set rpt = xtal.OpenReport(App.Path & "\REPORT\Oil_Stock_Ledger_Main.rpt")

the error message says:              
Run time error "13"
Type mismatch

please advice
Thanks
Mostafa
0
 
mlmccCommented:
Did you add CRAXDRT as a program reference?

mlmcc
0
 
Mostafa_ElSadekAuthor Commented:
Yes I added in a program reference but still gives me the same error.
Thanks

Mostafa
0
 
mlmccCommented:
Do you have another report you can try?

That sounds like it might be an error in the report itself not in your code.

mlmcc
0
 
Mostafa_ElSadekAuthor Commented:
THanks man it works now as It dll error.

Thanks

Mostafa
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!

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