In this project I am using datareport and dataenvironment for printing the receipt.
Please check the below code
Private Sub cmdprint_Click()
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
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)