VB 6.0 /CR 8.5 Sample Code 
Author Message
 VB 6.0 /CR 8.5 Sample Code

Hi all!

I am new using this software (Crystal Reports 8.5). Maybe
someone of you can post some code samples for me. I create
my report with CR 8.5 and it works fine by itself,
connecting directly to the database (SQL Server 2000), but
now, I want to call it directly from my Visual Basic 6.0
application and I just don't have a clue of how to do that.

Somebody can post examples of:  
- Connect to the DataBase (SQL Server)
- Send Formulas (Values) or Parameters
- Selection Formulas
- To Print
- etc. All that you can send please...

Do I have to use the Cristl32.OCX (I think this is an old
version) component or the New Crystal Report Viewer
component?

Thanks,

Mike



Mon, 19 Sep 2005 02:44:37 GMT  
 VB 6.0 /CR 8.5 Sample Code
Here's how I do it.

I create a form for the output.  I put a CRViewer object
on the form.  In the code I put:

Dim Report As CRAXDRT.Report

Private Sub Form_Load()

    Dim crxApplication As New CRAXDRT.Application
    Dim crxDatabaseTable As CRAXDRT.DatabaseTable

    Screen.MousePointer = vbHourglass
    Set Report = crxApplication.OpenReport(App.Path
& "\reportname.rpt")    'Use your own report name.
    For Each crxDatabaseTable In Report.Database.Tables
        crxDatabaseTable.Location = txtFileName
    Next crxDatabaseTable
    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport
    Screen.MousePointer = vbDefault

End Sub

Private Sub Form_Resize()

    CRViewer1.Top = 0
    CRViewer1.Left = 0
    CRViewer1.Height = ScaleHeight
    CRViewer1.Width = ScaleWidth

End Sub

In the calling form, I use:
frmOutput.Show

That's all there is to it.

Quote:
>-----Original Message-----
>Hi all!

>I am new using this software (Crystal Reports 8.5). Maybe
>someone of you can post some code samples for me. I
create
>my report with CR 8.5 and it works fine by itself,
>connecting directly to the database (SQL Server 2000),
but
>now, I want to call it directly from my Visual Basic 6.0
>application and I just don't have a clue of how to do
that.

>Somebody can post examples of:  
>- Connect to the DataBase (SQL Server)
>- Send Formulas (Values) or Parameters
>- Selection Formulas
>- To Print
>- etc. All that you can send please...

>Do I have to use the Cristl32.OCX (I think this is an old
>version) component or the New Crystal Report Viewer
>component?

>Thanks,

>Mike

>.



Mon, 19 Sep 2005 03:44:21 GMT  
 VB 6.0 /CR 8.5 Sample Code

Quote:
>-----Original Message-----
>Here's how I do it.

>I create a form for the output.  I put a CRViewer object
>on the form.  In the code I put:

>Dim Report As CRAXDRT.Report

>Private Sub Form_Load()

>    Dim crxApplication As New CRAXDRT.Application
>    Dim crxDatabaseTable As CRAXDRT.DatabaseTable

>    Screen.MousePointer = vbHourglass
>    Set Report = crxApplication.OpenReport(App.Path
>& "\reportname.rpt")    'Use your own report name.
>    For Each crxDatabaseTable In Report.Database.Tables
>        crxDatabaseTable.Location = txtFileName
>    Next crxDatabaseTable
>    CRViewer1.ReportSource = Report
>    CRViewer1.ViewReport
>    Screen.MousePointer = vbDefault

>End Sub

>Private Sub Form_Resize()

>    CRViewer1.Top = 0
>    CRViewer1.Left = 0
>    CRViewer1.Height = ScaleHeight
>    CRViewer1.Width = ScaleWidth

>End Sub

>In the calling form, I use:
>frmOutput.Show

>That's all there is to it.
>>-----Original Message-----
>>Hi all!

>>I am new using this software (Crystal Reports 8.5).
Maybe
>>someone of you can post some code samples for me. I
>create
>>my report with CR 8.5 and it works fine by itself,
>>connecting directly to the database (SQL Server 2000),
>but
>>now, I want to call it directly from my Visual Basic 6.0
>>application and I just don't have a clue of how to do
>that.

>>Somebody can post examples of:  
>>- Connect to the DataBase (SQL Server)
>>- Send Formulas (Values) or Parameters
>>- Selection Formulas
>>- To Print
>>- etc. All that you can send please...

>>Do I have to use the Cristl32.OCX (I think this is an
old
>>version) component or the New Crystal Report Viewer
>>component?

>>Thanks,

>>Mike

>>.

>.

With reference to Crystal Report Viewer control reference
your project to Crystal Report Active X Designer Run Time
library and Crystal Report Active X Designer Design Time
library.

Iztok Hudales



Wed, 21 Sep 2005 03:46:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Hlp on CR 8.5 and VB 6.0 sp5

2. CR 8.5 / VB 6.0 - Charts not printed

3. RightFax 6.0 and Crystal 8.5 and VB 6.0 Font size

4. CR 8.5 and CR from VS.Net package

5. Decimal Place problem after Upgrading from CR 6 to CR 8.5

6. CR 8 and CR 8.5

7. Using a dll that referenced CR 8.5 files on a machine that has CR 8.0

8. Parameter to Stored Procedure CR 8.5 VB.Net Specified Cast Not Valid

9. Logon Failed (VB.NET/CR 8.5)

10. can't print report (cr 8.5 / vb 6)

11. How send a report in CR 8.5 /VB 6 with PDF attachment

12. VB 6.0+Win2K+CR 8.5= a problem

 

 
Powered by phpBB® Forum Software