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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help me in Printing Crystal Report Documents in Visual Basic 6.

Status
Not open for further replies.
Nov 5, 2004
27
PH
Hi,
I have a problem in printing Crystal Report Documents in VB6.I have pass parameters from vb to Crystal Report 8.5. with these codes.

Public Sub setReportParam(strReport_Path As String, rptParameter As RptParam, _
bolView_Report As Boolean, Optional bolLedger As Boolean)
Dim CRXParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim CRXParamDef As CRAXDRT.ParameterFieldDefinition
Dim CRXaPP As New CRAXDRT.Application
Dim CRXReport, subreport As New CRAXDRT.Report


Dim Ctr As Integer, SQL As String

'CRXaPP.NewReport
Set CRXReport = CRXaPP.OpenReport(strReport_Path)
CRXReport.DiscardSavedData


Set CRXParamDefs = CRXReport.ParameterFields


For Each CRXParamDef In CRXParamDefs
With CRXParamDef
Ctr = 0
Do While rptParameter.strParamName(Ctr) <> Empty



If UCase(.ParameterFieldName) = Trim(UCase(rptParameter.strParamName(Ctr))) Then
Select Case rptParameter.DataType(Ctr)
Case adDate:
.SetCurrentValue CDate(rptParameter.strParamvalue(Ctr))
Case adVarChar, adChar:
.SetCurrentValue rptParameter.strParamvalue(Ctr)
Case adDecimal:
.SetCurrentValue CDbl(rptParameter.strParamvalue(Ctr))
End Select
End If
Ctr = Ctr + 1
Loop
End With
Next

CRXReport.EnableParameterPrompting = False
CRXReport.ReadRecords
CRXReport.PrintOut True, 1
Set CRXParamDefs = Nothing
Set CRXReport = Nothing
Set CRXaPP = Nothing
Set CRXParamDefs = Nothing

but whenever i used the Prinout command.It prompts for parameters.What should i do?Please help me.ASAP.
 

Dont know if this helps, but in CR9 the first parameter in the printout method is PromptUser (True or False)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top