Vb6 将参数传递到crystal报表

Vb6 将参数传递到crystal报表,vb6,crystal-reports,Vb6,Crystal Reports,我写了这段代码,但它有这个错误 运行时错误“20553”:参数字段名称无效 有人能帮我解决吗 带CR .ParameterFields(0)=“开始”+CStr(Form1.cmbMonth.Text)和“真” .ParameterFields(1)=“end;”+CStr(Form1.cmbYear.Text)和“True” .ReportFileName=App.Path&“\Report\Report1.rpt” .SelectionFormula=“{SW.dtaMonth}>=date

我写了这段代码,但它有这个错误

运行时错误“20553”:参数字段名称无效

有人能帮我解决吗

带CR
.ParameterFields(0)=“开始”+CStr(Form1.cmbMonth.Text)和“真”
.ParameterFields(1)=“end;”+CStr(Form1.cmbYear.Text)和“True”
.ReportFileName=App.Path&“\Report\Report1.rpt”

.SelectionFormula=“{SW.dtaMonth}>=date('”&Format(Form1.cmbMonth.Text)&“')和{SW.dtaYear}我认为Crystal在某个时候改变了将参数传递到外部(非嵌入式)报告的方式,但我不确定它们使用的是哪个版本。我拥有的版本是10,使用此方法传递参数:

.ParameterFields(n).AddCurrentValue "PARAMETER"
试试这个

With CR
  .ParameterFields(0) = "start;" & CStr(Form1.cmbMonth.Text) & ";True"
  .ParameterFields(1) = "end;" & CStr(Form1.cmbYear.Text) & ";True"
  .ReportFileName = App.Path & "\Report\Report1.rpt"
  .SelectionFormula = "{SW.dtaMonth}>=date('" & Format(Form1.cmbMonth.Text) & "') and {SW.dtaYear}<=date(" & Format(Form1.cmbYear.Text) & ")"
  .WindowTitle = "PG Variable Overhead Report" 'title of report   .Action = 1 'Will Show The Report
End With
带CR
.参数字段(0)=“开始;“&CStr(Form1.cmbmount.Text)和”;真的”
.参数字段(1)=“结束;“&CStr(Form1.cmbYear.Text)和”;真的”
.ReportFileName=App.Path&“\Report\Report1.rpt”
.SelectionFormula=“{SW.dtaMonth}>=日期('”&格式(Form1.cmbMonth.Text)&“')和{SW.dtaYear}
 CR.ParameterFields.Item(1).AddCurrentValue "YourValue"