Dynamic | loading | Crystal Report This question is asked in many forums. But no satisfactory answer has been found. Write a solution below
Dim SQL as String
Dim Rstliushui as New ADODB. Recordset
Dim Rpt as New craxddrt. The
Dim Printapp as New craxddrt. Application
If Option2.value = True Then
sql = "SELECT * from N_ihbill where DateDiff (d, Date, '" & Format (Dtpicker1.value, "Yyyy-mm-dd") & "') =0 and inpatient number =" &am P Cbopatient. ItemData (cbopatient. ListIndex)
Else
sql = "SELECT * from N_ihbill where DateDiff (d, Date, '" & Format (Dtpicker1.value, "Yyyy-mm-dd") & "') =0"
End If
Debug.Print SQL
If rstliushui.eof and Rstliushui.bof Then
MsgBox "No data available!" ", vbinformation
Exit Sub
End If
Set Rpt = Printapp.openreport ("Cryliushui.rpt")
Rpt.Database.SetDataSource Rstliushui
Call Viewreport (Rpt, "", "Print Water")
Rstliushui.close
Set Rstliushui = Nothing
This enables the logical separation of the program from the report. If you use Report Designer. You need to compile the program every time you change the report format. Customers can even change the report format themselves.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.