【问题标题】:pass parameter to crystal report将参数传递给水晶报表
【发布时间】:2012-04-27 07:14:40
【问题描述】:

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

“运行时错误'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

【问题讨论】:

    标签: vb6 crystal-reports


    【解决方案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
    

    【讨论】:

      【解决方案2】:

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

      .ParameterFields(n).AddCurrentValue "PARAMETER"
      

      【讨论】:

        【解决方案3】:
         CR.ParameterFields.Item(1).AddCurrentValue "YourValue"
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-02-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多