Solved

How I get call cr10 from VB6 by code

Posted on 2007-11-19
9
264 Views
Last Modified: 2008-02-01
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
Comment
Question by:Mostafa_ElSadek
  • 4
  • 4
9 Comments
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 20319643
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
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 20324618
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
 
LVL 100

Expert Comment

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

mlmcc
0
 

Author Comment

by:Mostafa_ElSadek
ID: 20333706
I'm using CR10 Product Type: Full , Product version : 10.0.0.533
thanks

Mostafa
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Mostafa_ElSadek
ID: 20334690
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 20337035
Did you add CRAXDRT as a program reference?

mlmcc
0
 

Author Comment

by:Mostafa_ElSadek
ID: 20341081
Yes I added in a program reference but still gives me the same error.
Thanks

Mostafa
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 20344452
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
 

Author Comment

by:Mostafa_ElSadek
ID: 20344977
THanks man it works now as It dll error.

Thanks

Mostafa
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now