Search code examples
vb6crystal-reports

How to view the report


Using VB6 & Crystal Report 9. Need help with the VB6 code.

When i click the button, i want to view the report in the form. Any ideas on how to view the report?


Solution

  • There is Crystal Report Viewer Control. Right click toolbox window and select Components... Then scroll down and select Crystal Report Viewer Control. Place it on a form and create a method to set path to report file, report parameters etc.

    Private Sub mShowReport()
    
        '...set report file...
        CRViewer1.ReportSource = "C:\Reports\MyReport.rpt"
        '...populate report params...
        '*** insert code here ***
        '...show it...
        CRViewer1.ViewReport
    
    End Sub