3

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

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

谁能帮我解决它?

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
4

3 回答 3

1

尝试这个 ...

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
于 2012-05-10T05:18:37.150 回答
0

我认为 Crystal 在某些时候改变了将参数传递给外部(非嵌入式)报告的方式,但我不确定他们使用的是哪个版本。我的版本是10,使用这种方法传入参数:

.ParameterFields(n).AddCurrentValue "PARAMETER"
于 2012-04-27T17:09:06.343 回答
-1
 CR.ParameterFields.Item(1).AddCurrentValue "YourValue"
于 2015-03-15T10:31:19.957 回答