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