I have not played with RDC. When I have done Crystal from VB, it was through the OCX. In that scenerio, I used Crystal Formulas other collections to override the settings that were in the RPT file.
I too have used the Crystal OCX with VB6. Not sure about all the differences with the RDC. Here's how it works with the OCX
Add a Crystal Report (CrystalReport1) control to your form.
Hi, I've made this to make it more easy. You just send the report, the name of the parameter (it is key sensitive), the value you want to set and the type of the parameter.
It cycles through the parameters collection untill it finds the one you are passing.
Claudia
Sub SetearParametrosReporte(Cr As CRAXDRT.Report, _
nombreparam As String, _
valor As Variant, _
Optional TipoDato As String = "STR"
Dim CRXParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim CRXParamDef As CRAXDRT.ParameterFieldDefinition
Set CRXParamDefs = Cr.ParameterFields
'This code cycles through the ParameterFieldDefinitions collection in the main report.
For Each CRXParamDef In CRXParamDefs
With CRXParamDef
Select Case .ParameterFieldName
'It finds and sets the appropriate Crystal parameter.
Case "MainParam"
.SetCurrentValue "Main Report Parameter"
'Now it finds and sets the appropriate stored procedure parameter.
Case nombreparam
Select Case TipoDato
Case "STR"
.SetCurrentValue valor
Case "DATE"
If IsNull(valor) Then
.SetCurrentValue CDate("01/01/1970"
Else
.SetCurrentValue CDate(valor)
End If
Case "INT"
.SetCurrentValue CLng(valor)
Case "BOOL"
.SetCurrentValue CBool(valor)
End Select
End Select
End With
Next
'Finally, it disables parameter prompting so the user won't be prompted for a value.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.