View Single Post
  #2 (permalink)  
Old December 8th, 2004, 05:22 PM
bickern bickern is offline
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.


Reply With Quote