Show Crystal Report Using VB 6.0 and Access Database

 

Write this code in VB6.0

Private Sub Command1_Click()

CrystalReport1.WindowState = crptMaximized
CrystalReport1.DiscardSavedData = True
CrystalReport1.ReportFileName = “DatabasePath”
CrystalReport1.DataFiles(0) = “ReportPath”

If you want to pass value from vb6.0 to Crystal Report

‘CrystalReport1.Formulas(0) = “FDate='” & fromDate & “‘”

Optional If you use password protected database
‘CrystalReport1.Password = Chr$(10) & “sanjoy-pakiza”

Optional If you use Selection Formula
‘CrystalReport1.SelectionFormula = “{tblEmployeePersonalInfo.EID}=” &  1
CrystalReport1.WindowShowPrintBtn = True
CrystalReport1.WindowShowPrintSetupBtn = True
CrystalReport1.Action = 1

End Sub

Advertisements