I have a VB6 application and use Crystal Repots to generate all reports. The problem is that sometimes the report may contain no data based on the parameter passed to it. In those cases crystal prints a blank page with header labels ( which wastes paper). I would like to be able to test if there is data in the report before I print.
I have noticed from the tech documentation that there is a function called GetNext Rows
which returns a rowset object. This could be used but I cannot get it to work. I attach a snippet of code
Set goCrystalApplication = Nothing
Set goCrystalAppReport = Nothing
Set goCrystalApplication = New CRAXDDRT.Application
Set goCrystalAppReport = New CRAXDDRT.Report
Set goCrystalAppReport = goCrystalApplication.OpenReport("ReportPath&Filename.rpt"), crOpenReportByTempCopy)
' Populate Parametes
' I want to test if there is data in the report; If not, then don't print
If <Test> then
' Select Printer
goCrystalAppReport.SelectPrinter "PrinterDriverName", "PrinterName", "PortName"
' Run Printout
goCrystalAppReport.PrintOut False, 1