Solved

Printing Crystal Reports from VB

Posted on 2001-08-24
11
506 Views
Last Modified: 2007-11-27
I am using Crystal Reports in my VB program to provide reports.  Now, these reports need to be printed also.  If I just use the default print button that comes with Crystal Reports everything is fine.  The report gets printed in the format it is supposed to be on the default printer.

Recently I was asked to change the printing functionality to allow the users to select a printer other that the default printer.  I have tried to use the Printer dialog box in VB.  The first time the user selects a printer - any printer - the report prints fine.  If the user does not close the report (form) and wants to print againg, and selects a different printer the formatting of the report goes bad (really bad).  It appears that vb does not use the correct driver.  

I need to allow my users to select a printer other that the default printer.  Any suggestions?

Thanks!
0
Comment
Question by:moncsi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 2

Accepted Solution

by:
daveherrmann earned 200 total points
ID: 6423352
Sure, dont use the print dialog in vb to select your printer.  I'm assuming your using the ocx to print the reports and your not using the api.

Right click on the ocx, click on the preview window tab and click on printer select.  This will add the printer setup button to the preview window.  If your doing it through the report designer, there is a similiar option (my machine is messed up or I would tell you where that is)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 6423384
Can you provide the code you use to do the printing?

If you allow the users to preview the report you can add a printer selection button to the preview screen by setting

CR1.WindowShowPrintSetupBtn = True

thanks
mlm
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6424237
Learning...
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:moncsi
ID: 6429376
Guys,

I am using RDC.  I have tried several different ways of letting the user select the printer.

Right now all I have is sending parameter in for the report, showing the report, then printing the report by using the defult print button on Crystal.  When using the VB common dialog, I do get the correct printer, but the output sucks.  If I do not use the common dialog I can not change the printer.  RDC has a method called SelectPrinter (driver, name, port) when I tried to use this I got a message saying I do not have enough memory.

I wanted to try the WindowShowPrintSetupBtn  property, but I could not find that property anywhere.

Help!
0
 
LVL 2

Expert Comment

by:daveherrmann
ID: 6429400
try this
 CRPrinterSettings.PrinterSetup Me.hWnd

the full doc with an exampl can be found at
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/printersettings.zip.asp?AJID=90FBBEF569D47A4A8EC1D52AD7C38FCD
0
 

Author Comment

by:moncsi
ID: 6429971
Thanks for the link.  It seems to have the same problem I do.  When I click on the Printer Setup Method to change the printer everything seems to be fine.  But when it prints it prints to the default printer no matter what was selected.  I think I am missing something!
0
 
LVL 2

Expert Comment

by:daveherrmann
ID: 6429973
can you post your code?
0
 
LVL 1

Expert Comment

by:ncw
ID: 6739526
I use crpReport.SelectPrinter (driver, name, port) and it works fine. My program allows the user to select a printer displayed in a listbox, the code iterates through the Printer collection setting the Printer object to the one matching the devicename the user selected, then I set:

crpReport.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port

Ok I have got 256K RAM but other machines it runs on have far less and they are ok.
0
 

Expert Comment

by:Jules_Madgwick
ID: 6961998
Using
CrystalReport1.PrinterSetup Me.hWnd
works fine !!!!
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7202513
Hi moncsi,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept daveherrmann@idg's comment(s) as an answer.

moncsi, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: Please COMMENT.  I don't really know who deserves points here.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7216006
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question