水晶报表的问题(大概很简单的)
各位大哥请了,我有个问题请教大家,因为我接了另一个同事的工作,而我没用过水晶报表,所以都不大明白。
问题是这样的,在程序里引用了crystl32.ocx,他是在类模块里统一做的打印,做了10个函数,每个的代码都大致一样,如下,可是,有几个是好的,有两个却在运行时报错,提示属性只读,调试时停在cryRep.ReportFileName 这步,单步执行到cryRep.Action = 1 时,提示框出现,说属性只读。可是另一个报表除了用的模板不同之外,代码都一样,却可以正常显示,我真的不明白为什么,请大家帮帮我好么?
开发环境是win2000 pre,VB6中文,水晶8.0
是和版本有关系吗?
而且,把程序拿到我这里根本就一个也出不来了,我的是win 2000 server,中文vb6
以下是报错的一段代码
Dim cryRep As CrystalReport
cryRep.Connect = "Dsn=" & ODBC1Val
cryRep.ReportFileName = App.Path & "\cry06.rpt"
ClearCryParameters cryRep
cryRep.ParameterFields(0) = "Rate;" & GetSysDiscount / 100 & ";true"
cryRep.ParameterFields(1) = "aYear;" & aYear & ";true"
cryRep.ParameterFields(2) = "aMonth;" & aMonth & ";true"
cryRep.Destination = crptToPrinter
cryRep.Action = 1
Set cryRep = Nothing