Printing Crystal Reports in vb 2005

TMI

Member
Joined
Oct 15, 2003
Messages
16
I am printing several extrenal reports that were created in Crystal Reports XI through code in vb 2005. But, sometimes there will be a report that does not have any information for it but a blank page gets printed anyways. I have been trying everything I can think of so that the blank reports will not be printed. But have had no luck yet. Below is the typical code used for each report.

rptToOpen.SetParameterValue("LabelName", strRouteTo)
rptToOpen.PrintOptions.PrinterName = strWorkOrderPrinter

Try
///This is one of my attempts at solving my problem///
If rptToOpen.Rows.Count > 1 Then
rptToOpen.PrintToPrinter(1, True, 0, 0)
else
Do not need to print the report
End If
////////////////////////////////////////////////////////////

rptToOpen.PrintToPrinter(1, True, 0, 0)
Catch err As ApplicationException
MessageBox.Show(err.ToString, "Error with " & report, MessageBoxButtons.OK, MessageBoxIcon.Error)
isError = True
Exit Sub
End Try

HELP!!!!!
 
Last edited by a moderator:
Back
Top