Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2005, 07:42 AM
Authorized User
 
Join Date: Mar 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to pritz Send a message via Yahoo to pritz
Default 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



 
Old June 29th, 2005, 11:41 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old December 25th, 2005, 11:37 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old December 28th, 2005, 04:27 PM
Registered User
 
Join Date: Dec 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"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

 
Old January 20th, 2006, 07:18 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old January 20th, 2006, 08:59 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default


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
 
Old January 20th, 2006, 06:57 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Marcogol Send a message via Yahoo to Marcogol
Default

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...

 
Old January 23rd, 2006, 02:56 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default


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
 
Old February 8th, 2006, 03:18 PM
Registered User
 
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old April 23rd, 2006, 08:09 PM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to murari
Default

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
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6 wont display crystal Reports 10.0 cnobles VB How-To 2 September 7th, 2014 09:21 AM
About Crystal Report 10 Suhas VB How-To 2 April 9th, 2007 11:27 PM
Vb6 with crystal reports 10 Eleakim Cribe Pro VB 6 0 June 22nd, 2006 09:20 AM
good book for crystal report 10 swati_joshi ASP.NET 1.0 and 1.1 Basics 1 April 20th, 2006 03:09 AM
crystal report 10 santwan Classic ASP Professional 0 December 16th, 2005 05:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.