p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   VB6 with crystal report 10 (http://p2p.wrox.com/showthread.php?t=30308)

pritz June 10th, 2005 07:42 AM

VB6 with crystal report 10
 
Hi Friends,

i m new to do this ...how could i call my crystal report 10 in vb6?
plz give some information regarding which component and references
is to be added in vb6 to make crystal report working?

i would be thankful for your affords.

Regards,
Pritz




Raghavendra_Mudugal June 29th, 2005 11:41 PM

Hello

For Calling the .rpt file in vb6, make a reference
of the control Crystl32.ocx "Crystal Report Control"

You will find a control in the toolbox, add that control into the form.

You can use the control's methods and properties
to set the file name of that .rpt file and set
the action property to "1".

It will show the report.

Hope this helps.

With Regards,
Raghavendra Mudugal

ahmed_hammam70 December 25th, 2005 11:37 AM

You Can Use the following code after adding the component : Crystal ActiveX Report Viewer Library 10.0
-----------
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
Set Report = Appl.OpenReport("d:\Report3.rpt")
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
----------

where CRViewer1 is the name of the added component to your project


haianoop December 28th, 2005 04:27 PM

"Crystal Report Control" (Crystl32.ocx) is not available from Crystal reports 9 onwards. so the
posting by Raghavendra Mudugal dosent work. The second posting is OK and is the best method


pravin123 January 20th, 2006 07:18 AM

Hello friends

When i used the following code to run the crystal report.
error message displayed "User defined Type not defined".

Wht is this CRAXDRT i can not use it in my VB6 from.

If anybody can help me....


Quote:

quote:Originally posted by ahmed_hammam70
 You Can Use the following code after adding the component : Crystal ActiveX Report Viewer Library 10.0
-----------
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
Set Report = Appl.OpenReport("d:\Report3.rpt")
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
----------

where CRViewer1 is the name of the added component to your project



nalla January 20th, 2006 08:59 AM


Hi pritz,

   There are 2 ways to display a crystal report. You can use DSR(Crystal report designer) or external reports. Since you are new to this use the second method.

   Create your crystal report and include it in a folder in your application path.Then you can call it in your VB form. Add a crystal report control on your form then assign the report file name/window state/selection formula(if needed) and action(1=to display the report)

Let us know if you need more help or sample code regarding this.


nalaka hewage

Marcogol January 20th, 2006 06:57 PM

sorry for the bump but i cant get how to get this work...

how do i call the report from my folder and how do i print preview it before printing?? please help me... this is due in a few hours...


nalla January 23rd, 2006 02:56 AM


Hi Marcogol,
Follow these steps and tell me where you fail? (if needed)

(1) Create the report using crystal reports inside a folder called reports in your application path. Make sure your report is working properly without any bugs. (you can do this by refreshing report's data)
(2) Add a crystal report contrroller on your vb form. (if you can't see crystal report control in your tollbox, go to Project-->Components-->Crystal Report Control to add crystal report control to your toolbox)
(3) In your vb code,

    Private Sub cmdPrint_Click()
        ' Assign report name
        CrystalReport1.ReportFileName=App.Path & "\Report1.rpt"
        ' command to display the report
        CrystalReport1.Action=1
        ' Set window state and other properties laso
    End Sub

* Note: CrystalReport1 - Crystal report control name
         Report1.rpt - crystal report name which contain in reports folder


nalaka hewage

DRock February 8th, 2006 03:18 PM

Please let me know if anyone gets a good solid answer for this. Nothing above works with version 10. Works with older versions but not 10. Thanks for your help


murari April 23rd, 2006 08:09 PM

Quote:

quote:Originally posted by ahmed_hammam70
 You Can Use the following code after adding the component : Crystal ActiveX Report Viewer Library 10.0
-----------
Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
Set Report = Appl.OpenReport("d:\Report3.rpt")
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
----------

where CRViewer1 is the name of the added component to your project


Dear ahmed_hammam70,
I am in the look out of a solution of previewing and printing a report created in crystal report 8x through VB6. I was directed to this forum link and with the help of your code, I could preview the report. But I could not get the same printed even if I change the "CRViewer1 propoerty to print report. Can you help me ?


with regards

Murari


Murari
murariraghavan@yahoo.co.in


All times are GMT -4. The time now is 11:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.