我想打印收据,但我遇到了问题 [英] I want to print a reciept but i face a problem
本文介绍了我想打印收据,但我遇到了问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在这个项目中,我正在使用datareport和dataenvironment来打印收据.
请检查以下代码
In this project I am using datareport and dataenvironment for printing the receipt.
Please check the below code
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
当我单击打印命令时,显示以下错误
When I click on the print command it shows the following the error given below
Run-time error ''5'':<br />
<br />
Invalid procedure call or argument
当我单击debug时,它突出显示了以下行
DataEnvironment1.Commands(1).CommandText =选择ID,患者名,患者年龄,参照,测试,接收金额中的金额,其中ID ="& Val(txtid.Text)
and it highlights the following line when I click on debug
DataEnvironment1.Commands(1).CommandText = "select ID,patient_name,patient_age,referedby,test,amount from reception_detail where ID=" & Val(txtid.Text)
推荐答案
您的主要问题是VB6.
不要!
获取VB.Net,除了受支持之外,与VB6相比,还有更多功能.
至于您的代码,是否已在本节之前进行了所有声明?
命令是数组吗?
Your main problem is VB6.
Don''t!
Get VB.Net, apart from it being supported, unlike VB6, there is a lot more functionality.
As for your code, have all the declarations been made prior to this section?
Is Commands an Array?
很难从中分辨出来,但是尝试分阶段进行检查.放入一个断点,然后查看
DataEnvironment1
-有效吗?
DataEnvironment1.Commands
-好吗?
DataEnvironment1.Commands(1
)-这可能是问题所在.
DataEnvironment1.Commands(1).CommandText
-应该没问题.
如果所有这些看起来都不错,请检查txtid中的值,然后检查txtid.Text中的值.
Difficult to tell from that, but try checking it in stages. Put a breakpoint in, and look at
DataEnvironment1
- is it valid?
DataEnvironment1.Commands
- ok?
DataEnvironment1.Commands(1
) - This is probably the problem.
DataEnvironment1.Commands(1).CommandText
- should be ok.
If all of that looks good, check the value in txtid and then txtid.Text.
这篇关于我想打印收据,但我遇到了问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文