Advertisement
2002C Miscellaneous #9917

Run Crystal Reports within VB6 with Record Selecti

THis short piece of code illustrates how to imbed Crystal Reports into VB. While simple, it does not seem to be documented well anywhere.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
'' if using record selection for report on siingle record
' set v_choice as public string
' store your record selction field choice to v_choice
'*******************************************
'Add the crystal ocx object to form (will be named CrystalReport1)
' you can pass record selection
''NOTE
''Create the report in Crystal first and place the report in the same directory as your database.
'' Set the report location to same as database in Crystal
''This part is run from menu or command button
CrystalReport1.ReportSource = crptReport
CrystalReport1.ReportFileName = reportpath & "\YOUR_REPORT_NAME.rpt"
'***This line only is using single record selection
CrystalReport1.ReplaceSelectionFormula ("{TABLENAME.FIELDNAME} =" & "'" & v_choice & "'")
'*********
CrystalReport1.WindowState = crptMaximized
CrystalReport1.PrintReport
CrystalReport1.PageZoom (50)
Komentar Asli (3)
Dipulihkan dari Wayback Machine