I now have this working.
Thanks.
> Thank you, but I am still having trouble. I am using VB 6 and Crystal
> Reports 8.0 on Windows 2000. I get as error
> the "object doesn't support this property of method"
> on this line "Parameter.AddCurrentValue Format(value)",.
> Do you have Report defined diffferently or do you see some other
difference?
> My object also does not support "parameter.ClearCurrentValueAndRange".
> It seems that my object Parameter is not the same as your prm.
> At the top of my routine is the following:
> Function SetParameter(Report As CRPEAuto.Report, _
> ByVal ParameterName As String, ByVal value As Variant)
> Dim Parameters As CRPEAuto.ParameterFieldDefinitions
> Dim Parameter As CRPEAuto.ParameterFieldDefinition
> Then I have the following:
> 'ParameterName comes from the calling code and is different for each
report
> ' Set Parameters = Report.ParameterFields
> For Each Parameter In Report.ParameterFields
> valueType = Parameter.valueType
> If LCase(Parameter.Name) = ParameterName Then
> valueType = Parameter.valueType
> If valueType >= 1 And valueType <= 8 Then
> Parameter.AddCurrentValue Format(value)
> > I'm using the following snippet :
> > For Each prm In Report.ParameterFields
> > prm.ClearCurrentValueAndRange
> > Select Case prm.Name
> > prm.AddCurrentValue CLng(Prosit.Projet_pk)
> > ' Feed...
> > ' Feed...
> > Case Else
> > MsgBox "Paramtre d'tat " & prm.Name & " non gr.",
> > vbExclamation
> > End Select
> > Next
> > Bascially I browse the parameters and I use a particular variable in my
> app
> > to provide a value for this parameter based on its name...
> > Formulas are likely the formula calculated inside the report from your
> > database fields...
> > > I have a Crystal 8 report which uses a stored procedure for its data.
> The
> > > stored procedure has 3 parameters, so I need to pass values from VB to
> the
> > > report at run time, but I cannot get it to work.
> > > For formula passing, we use the following code:
> > > Function SetFormula(Report As CRPEAuto.Report, ByVal formulaName As
> > String,
> > > ByVal value As Variant)
> > > Dim formulas As CRPEAuto.FormulaFieldDefinitions
> > > Dim formula As CRPEAuto.FormulaFieldDefinition
> > > Set formulas = Report.FormulaFields
> > > For i = 1 To formulas.Count
> > > Set formula = formulas(i)
> > > ...
> > > formula.Text = Format(value)
> > > I cloned this and changed "formula" to "parameter", but it will not do
> > > "parameter.text = value" or "parameter.SetCurrentValue 101". For the
> > second
> > > one it gives an erorr message that the value (101) is not in the enum
> > list.
> > > I have looked in Helps but cannot find anything on this subject.
> > > The manual "Version 8.5 Developer's Guide" (I am using version 8), on
> page
> > > 83 gives Dim's like this:
> > > Dim CRXParamDefs as CRAXDRT.ParameterFieldDefinitions
> > > Dim CRXParamDef as CRAXDRT.ParameterFieldDefinition
> > > However, I cannot find out what object CRAXDRT is. I tried a Report
> > object,
> > > but that did not work. I looked for CRAXDRT in Help but found nothing.
> > > Does anyone have a piece of actual code they could send me by email
> which
> > > shows how to set the parameters to the report?
> > > Thanks in advance.
> > > Marvin