VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Run Crystal Reports within VB6 with Record Selecti

by Steven Smith (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (7 Votes)

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

Inputs
If using record selection (printing a selected record) v_choice is a variable to be passed to the record selection part of Crystal
Assumes
Crystal OXC from VB application is on Form You will have a menu option or command button to launch report
API Declarations
v_choice used for record selection (assign value to v_choice that matches field value)

Rate Run Crystal Reports within VB6 with Record Selecti

'' 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)

Download this snippet    Add to My Saved Code

Run Crystal Reports within VB6 with Record Selecti Comments

No comments have been posted about Run Crystal Reports within VB6 with Record Selecti. Why not be the first to post a comment about Run Crystal Reports within VB6 with Record Selecti.

Post your comment

Subject:
Message:
0/1000 characters