p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   VB How-To (http://p2p.wrox.com/vb-how-78/)
-   -   Crystal reports 9.0 with Visual Basic 6.0 (http://p2p.wrox.com/vb-how/5838-crystal-reports-9-0-visual-basic-6-0-a.html)

rahulmoray November 6th, 2003 03:32 AM

Crystal reports 9.0 with Visual Basic 6.0
 
Is there any crystal reports control to call the reports file from vb, like we have it in Crystal Reports 7 and 8.

Else what is the way I can open a Crystal Reports 9.0 file in VB ???

bickern December 8th, 2004 05:22 PM

This is what I do using Crystal Reports 9 with VB6

When creating an ActiveX Designer Report (DSR), the Crystal Reports
Gallery dialog appears. Choose From an Existing Report and browse to
the report file. The Report file will be converted to a DSR for use with the RDC in Visual Basic.

The wizard does the rest.

Then enter your code as normal.

or

Because your finished exe may end up being large / more functionality

Add a Form
Insert controls - CommonDialog1 - CRViewer91

Dim lApplication As CRAXDRT.Application
Dim lReport As CRAXDRT.Report

Private Sub mnuFileOpen_Click()
Dim strRpt As String
Dim Report
                                                                            'Set filters for the Open dialog to choose only a RPT file
    CommonDialog1.Filter = "Report (*.rpt)|*.rpt"
    CommonDialog1.ShowOpen
                                                                           'Set the filename selected to the string variable
    strRpt = CommonDialog1.FileName
Set lApplication = New CRAXDDRT.Application
Set lReport = lApplication.OpenReport(strRpt) ' Open the report
    CRViewer91.ReportSource = lReport
    CRViewer91.ViewReport
    lReport.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM NEW DATA

Exit Sub
Errhandler:
    MsgBox Err.Description & " " & Err.Number
End Sub

Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub


Hope this helps.




All times are GMT -4. The time now is 12:17 AM.

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