Help CRViewer! 
Author Message
 Help CRViewer!

Hello!
I am using VB6 and CR8. On a VB form, I need to use the CRViewer to let user
view a pre-defined Crystal Report ( a .rpt file). How ever, I have no idea
how to let it work. I referenced all Crystal report automation servers but
the sample code given by Seagate's Developer Help does not work:

Private Sub Form1_Load()
Line1: Dim report As New CrystalReport1
          CRViewer1.ReportSource = report
          CRViewer1.ViewReport
End Sub
Line 1 gives an error: User-defined type not defined.

It seems to me the ReportSource property should be the Report object. The
following code works on load the form:

Private Sub Form1_Load()
     Dim crpt As new Report
     CRViewer1.ReportSource = report
     CRViewer1.ViewReport
End Sub

But when close the form, I got an Application Error and the VB Project
crashed.

My questions
1. What is the right thing to assign to the ReportSource property?
2. How can I let the CRViewer work with a .rpt file created by Crystal
Report? Is it possible?

Thanks!
George



Tue, 25 Feb 2003 03:23:16 GMT  
 Help CRViewer!
George,

Try this

Dim Report As CRAXDRT.Report
Dim Application As CRAXDRT.Application

Set Application = CreateObject("CrystalRuntime.Application")
Set Report = Application.OpenReport(App.Path & "\Report.rpt")

This is the main section of code that I used to do exactly what you require.
However, I was getting strange results, some time the report would display
and other times it wouldn't. Anyway, give it a go and see what happens.

David.

Quote:

>Hello!
>I am using VB6 and CR8. On a VB form, I need to use the CRViewer to let
user
>view a pre-defined crystal report ( a .rpt file). How ever, I have no idea
>how to let it work. I referenced all Crystal report automation servers but
>the sample code given by Seagate's Developer Help does not work:

>Private Sub Form1_Load()
>Line1: Dim report As New CrystalReport1
>          CRViewer1.ReportSource = report
>          CRViewer1.ViewReport
>End Sub
>Line 1 gives an error: User-defined type not defined.

>It seems to me the ReportSource property should be the Report object. The
>following code works on load the form:

>Private Sub Form1_Load()
>     Dim crpt As new Report
>     CRViewer1.ReportSource = report
>     CRViewer1.ViewReport
>End Sub

>But when close the form, I got an Application Error and the VB Project
>crashed.

>My questions
>1. What is the right thing to assign to the ReportSource property?
>2. How can I let the CRViewer work with a .rpt file created by Crystal
>Report? Is it possible?

>Thanks!
>George



Tue, 25 Feb 2003 20:26:10 GMT  
 Help CRViewer!
Thank you David!
It works now. It's a good start for me.
Thank you again!
George


Quote:
> George,

> Try this

> Dim Report As CRAXDRT.Report
> Dim Application As CRAXDRT.Application

> Set Application = CreateObject("CrystalRuntime.Application")
> Set Report = Application.OpenReport(App.Path & "\Report.rpt")

> This is the main section of code that I used to do exactly what you
require.
> However, I was getting strange results, some time the report would display
> and other times it wouldn't. Anyway, give it a go and see what happens.

> David.


> >Hello!
> >I am using VB6 and CR8. On a VB form, I need to use the CRViewer to let
> user
> >view a pre-defined crystal report ( a .rpt file). How ever, I have no
idea
> >how to let it work. I referenced all Crystal report automation servers
but
> >the sample code given by Seagate's Developer Help does not work:

> >Private Sub Form1_Load()
> >Line1: Dim report As New CrystalReport1
> >          CRViewer1.ReportSource = report
> >          CRViewer1.ViewReport
> >End Sub
> >Line 1 gives an error: User-defined type not defined.

> >It seems to me the ReportSource property should be the Report object. The
> >following code works on load the form:

> >Private Sub Form1_Load()
> >     Dim crpt As new Report
> >     CRViewer1.ReportSource = report
> >     CRViewer1.ViewReport
> >End Sub

> >But when close the form, I got an Application Error and the VB Project
> >crashed.

> >My questions
> >1. What is the right thing to assign to the ReportSource property?
> >2. How can I let the CRViewer work with a .rpt file created by Crystal
> >Report? Is it possible?

> >Thanks!
> >George



Tue, 25 Feb 2003 21:45:46 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Urgent Help required on Crviewer crash

2. Help using CRViewer

3. CRViewer Help please

4. Help with CrViewer

5. Help with crviewer.dll and urlmon.dll dependencies

6. CRViewer Export Problems (Word / Excel)

7. problems with seagate crystal report 6.0(crviewer.dll) and vb5

8. problems with seagate crystal reports6 (crviewer.dll) and vb5

9. CRViewer in form stays too small (do not use the hole form size)

10. Wrong CRViewer.dll Version

11. Que es el crviewer

12. CRViewer CloseButton not enabled ?

 

 
Powered by phpBB® Forum Software