0
votes

I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.

I don't want to save the label, I just want it to print directly after the system has created it.

Dim ap9 As craxdrt.Application
Dim rpt9 As craxdrt.Report
Dim dbt As craxdrt.DatabaseTable

Set ap9 = New craxdrt.Application
On Error GoTo errError2

Set iniFile = New CIniFile
On Error GoTo errError3

Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
On Error GoTo errError4

For Each dbt In rpt9.Database.Tables
    dbt.Location = iniFile.pathDbCosmet
    If dbt.ConnectionProperties.count <= 5 Then
        dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
    End If
Next

rpt9.RecordSelectionFormula = sFormula
rpt9.PrintOut False, CInt(txtPacksReceived.Text)

The following code allows me to select a printer

enter image description here

and after clicking 'Print' at that point I am shown another dialog

enter image description here

However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.

Is there some reason why I'm not able to print my labels?

2

2 Answers

0
votes

I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?

0
votes

Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.

If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?