cancel
Showing results for 
Search instead for 
Did you mean: 

Cystal Report XI R2 11.5.9.1076 using RDC and VB6. SelectPrinter not work

Former Member
0 Kudos

I have been using crystal report since version 3.0

I am trying to re-directed a report output directly to a printer. (Not the default printer)

The following is the relevant code.

It executes, but the report doesn't go to the proper printer and in design mode it crashes the environment sometimes.

If PrinterName <> "" Then

Dim DriverName As String

Dim PrtName As String

Dim PortName As String

Dim Prt As Printer

For Each Prt In Printers

If UCase(Prt.DeviceName) = UCase(PrinterName) Then

PrtName = Prt.DeviceName

DriverName = Prt.DriverName

PortName = Prt.Port

Rpt.SelectPrinter DriverName, PrtName, PortName

Rpt.PaperSize = Printer.PaperSize

Rpt.PaperSource = Printer.PaperBin

Exit For

End If

Next

End If

Any help would be greatly appreciated.

Kalman Skulski

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello, Kalman;

Are you installing the update on the Development system with a full install of Crystal Reports or on a client with runtime only?

I have not had any issues myself with SP4.0. What space is available on that system?

You may want to try downloading the Service Pack again to be sure it has not been corrupted.

I do not have any information on the expected release of SP 5.0 other than it is being worked on.

Elaine

Former Member
0 Kudos

I tried it again later and it did run through. It's a large patch an took a while.

I had outlook and firefox and SQL Management Studio open when I was installing it the 1st time. perhaps there was a conflict.

Former Member
0 Kudos

Hello Kalman,

I notice - just like me - you are "struggling" with VB6 and CR 11.5 - perhaps we can exchange some helpful experiences - you can contact me - if interested - by flusi08 ( at ) t-online.de.

Good luck

Miko

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello, Kalman;

There is code that will set "No Printer" at runtime. In your code set:

Report.SelectPrinter("DISPLAY", "", "")

When the printer settings are set. save the report to a new file.

Report.SaveAs "C:\Temp\noPrinter.rpt", crDefaultFileFormat

You cannot overwrite the file you are changing. It will give you an error that the file is in use by another application.

Elaine

Former Member
0 Kudos

Thanks Elaine

I'll give it a try. How can I deploy the fix, assuming you release it, to my clients? Does it come in a merge module?

Former Member
0 Kudos

Hello, Kalman;

Once the full Service Pack 5.0 is released with that fix in it, matching Merge Modules will also be released.

Elaine

Former Member
0 Kudos

OK,

I am at SP3 right now. I have tried to install SP4 but it just hangs at checking for available space. Is this a known issue?

What is a guesstimate. I won't hold you to if for SP5?

Thanks for you help Kal

Former Member
0 Kudos

Hello, Kalman;

There is no option to set the report to "No Printer" at runtime.

I have found the update you need but I have to have it made available outside of paid support through the Service Marketplace if possible so you can access it. That may be available sometime next week. I will let you know.

That should resolve the Default printer issue so you do not have to change all of the reports.

Elaine

Former Member
0 Kudos

Hello, Kalman;

The property of Default Printer was broken in version XI R1 (11.0). It has been fixed in XI R2 (11.5) in Fix Pack 4.1. I am trying to find a link to it for you.

It is also fixed in SP5.0 which has not yet been released.

For a workaround, choose "No Printer" in the report on your development machine and save the report. It should work when you set it at runtime.

Elaine

Former Member
0 Kudos

Thanks Elaine,

That made the difference!

Now is there a programmatic way to do this? I have lots of sites with existing reports that don't have the no printer option set.

Former Member
0 Kudos

Hello, Kalman;

There was a change in the code and in version 11.5 you need to set the Orientation when you use SelectPrinter.

Private Sub btnPrint_Click()

Report.SelectPrinter DriverName, PrtName, PortName

'PaperOrientation is required when setting SelectPrinter

Report.PaperOrientation = crDefaultPaperOrientation

'Report.PrinterDuplex = crPRDPDefault

'Report.PaperSize = crPaperA4

'Report.PaperSource = crPRBinAuto

Report.PrintOut True, 1, True, 1, 3

End Sub

Be sure the printer driver you are loading supports the properties you have set.

Elaine

Former Member
0 Kudos

Thanks for your quick response Elaine.

I tried your suggestion.

I changed my code and added Rpt.PaperOrientation = crDefaultPaperOrientation

Rpt.SelectPrinter DriverName, PrtName, PortName

Rpt.PaperSize = Printer.PaperSize

Rpt.PaperSource = Printer.PaperBin

Rpt.PaperOrientation = crDefaultPaperOrientation

But it still is printing to my default printer and not the printer I am setting it to. It used to work in 8.5.

Kalman Skulski