PDA

Click to See Complete Forum and Search --> : Passing parameter to crystal from VB


Luis Moises Rojas
Sep 8th, 2003, 02:50 PM
am trying 2 pass a parameter to crystalreport in VB
With reporte
s = " id='" & CStr(iid) & "'"
.ParameterFields(0) = s
.ReportFileName = "\\xx.x.x.x\Reportes\Suscripciones" & "\" & "Contracto de Suscripcion1.rpt"
.Action = 1
End With

where par(0) is a number and a parameter in crystal.
I got the message: Invalid parameter name.
what is wrong?
How can i do it?

I mean, when i call the report i need to pass the formula, but the i do not want that the parameter screen to be displayed.

ARPRINCE
Sep 9th, 2003, 12:17 PM
I use CR9 and this is how I do it:



Dim CRXParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim CRXParamDef As CRAXDRT.ParameterFieldDefinition
Set CRXParamDefs = crxReport.ParameterFields

'DISABLE PROMPTING
crxReport.EnableParameterPrompting = False

For Each CRXParamDef In CRXParamDefs
With CRXParamDef
'GET THE PARAMETER NAME
Select Case .ParameterFieldName
Case "@ServiceTimeLine"
'SET THE VALUE (REPORT_PRMx is a Variable)
.SetCurrentValue REPORT_PRM2
Case "@FormCode"
.SetCurrentValue REPORT_PRM1
End Select
End With
Next