Wednesday, April 7, 2010

How to View Crystal Report In Visual Basic 6


This sample code view the crystal report file (Employee.rpt) , please don't forget to add the Crystal Report Component or you got an error.

Private Sub cmdEmployee_Click()
On Error GoTo errHandler
    If Right(App.Path, 1) = "\" Then
        rep1.ReportFileName = App.Path + "Employee.rpt"
    Else
        rep1.ReportFileName = App.Path + "\" + "Employee.rpt"
    End If
    rep1.Action = 1
    Exit Sub
errHandler:
    MsgBox Str(Err.Number) + " " + Err.Description
End Sub

0 comments:

Post a Comment

 
Powered by Blogger