Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

previewing report on crystal 8

Status
Not open for further replies.

mariabenita

Programmer
Jun 18, 2001
13
0
0
SG
how is previewing reports done dynamically using ado recordsets in vb6? we have already gone through the process of preparing the data for the report, the only problem is we can't find the method equivalent to .preview in crystal 7.

here's part of the code.

lsSql = "SelProcCustomer " & Chr(34) & SCUST & Chr(34)

' (This line initialized the variable to indicate where the report is located)
lsRpt = RPT_PATH & "\SAMP_RPT.RPT"

' (Get the Report content by opening a resultset of the SP)
If lRs.State = adStateOpen Then lRs.Close
lRs.Open lsSql, ADOCN, adOpenDynamic, adLockOptimistic


If Not lRs.BOF And Not lRs.EOF Then
lRs.MoveLast
Else
MsgBox "No record to print.", vbOKOnly, "Message"
Screen.MousePointer = vbDefault
Exit Sub
End If

' (Create an instance of the Crystal Application object)
' (Create an instance of the Crystal Report object from the Crystal Application object)
Set gcrpReport = lsApp.OpenReport(lsRpt)

' (Initialize Other objects required by the report)
Set reportDb = gcrpReport.Database
Set reportTables = reportDb.Tables
Set reportTable = reportTables.Item(1)
reportTable.SetPrivateData 3, lRs

' (View report to Screen)
??? (HELP)
 
You need to have a VB form with the CRViewer control. Then you need to attach the report to the CRViewer control.

CRViewer1.ReportSource = gcrpReport
CRViewer1.ViewReport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top