我编写此代码但它有此错误。
“运行时错误'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
答案 0 :(得分: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
答案 1 :(得分:0)
我认为Crystal在某些时候改变了参数传递给外部(非嵌入式)报告的方式,但我不确定他们使用哪个版本。我的版本是10,并使用此方法传递参数:
.ParameterFields(n).AddCurrentValue "PARAMETER"
答案 2 :(得分:-1)
CR.ParameterFields.Item(1).AddCurrentValue "YourValue"