返回首页

在这个项目中,我使用的数据报表打印的收据和数据环境。

请检查下面的代码

Private Sub cmdprint_Click()

    'Set rpt = New ADODB.Recordset

    'rpt.Open "select * from reception_detail where ID=" & Val(txtid.Text), Con, adOpenStatic, adLockOptimistic, adCmdText



    DataEnvironment1.Commands(1).CommandText = "select ID,patient_name,patient_age,referedby,test,amount from reception_detail where ID=" & Val(txtid.Text)

    rptreciept.PrintReport

    rptreciept.Show

End Sub
当我点击打印命令如下,它显示了以下错误

运行时错误'5':

无效的过程调用或参数

它突出了以下行,当我点击调试

(1)DataEnvironment1.Commands的CommandText ="SELECT ID,patient_name,patient_age,referedby,测试,从reception_detail量,其中ID ="放大器;瓦尔(txtid.Text)

回答

评论会员:游客 时间:2012/02/05
Dalek戴夫:你的主要问题是VB6不要!获取VB.Net,不像维生素B6,除了它的支持,有很多更多的功能。至于你的代码,所有的声明作出之前,本节?是命令阵列
?OriginalGriff:难告诉,但尝试检查阶段。把一个断点,看看

DataEnvironment1 - ?是有效的
DataEnvironment1.Commands - OK
DataEnvironment1.Commands(1) - 这可能是问题
应该是确定的CommandText,。DataEnvironment1.Commands(1) -

如果所有这一切都看起来不错,在txtid然后txtid.Text检查的价值:Dalek戴夫
评论会员:游客 时间:2012/02/05
频率有时会出现一个具体项目的数量或没有你的意思最接近的日期为当前日期?如果它的第一,那么你就必须设置一个计数器,并增加每个匹配或匹配的数组/列表中插入日期。如果它的第二个,那么你将有比较日期