Solved

Select a printer from crystal viewer

Posted on 2003-11-30
6
814 Views
Last Modified: 2007-12-19
I'm trying to make it possible to select a printer when you press the printer button when using crviewer.  I Used this  code from crystal decisions:
                   Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)

                    UseDefault = False
                    On Error GoTo Cancel:
                    CommonDialog1.CancelError = True
                    CommonDialog1.ShowPrinter
                    MyRep.PrintOut False  
                    Exit Sub
                    Cancel:
                    MsgBox "Printing cancelled"
                    Exit Sub
                    End Sub
Everything works fine until after I've select my printer and click print.  At this point i get the "Printing cancelled" message box and nothing works. Any help would be greatly appreciated.
0
Comment
Question by:asmit8
6 Comments
 

Author Comment

by:asmit8
Comment Utility
Is there a reference or component i'm missing or something?
0
 
LVL 3

Assisted Solution

by:kathmacmahon
kathmacmahon earned 40 total points
Comment Utility
I had written similar code that worked up until Windows 2000 was released.  I determined that no matter the orientation selected on the print dialog, crystal wouldn't catch it.  I don't know if that's still an issue but you should probably test that.  Your users may try to make changes to their printer settings in the common dialog that might not change the way the report prints.

I think what you need to do is change your MSGBox to output the error that is occuring, because it might not be Printing Cancelled.  I ran the same code in their sample project and it worked.

Ultimately, I ended up placing the viewer on a form and disabling most of the inherit toolbar items and creating one of my own that allows the user to select either 'print' or 'print setup'.  There's a sample below that shows all the various ways to affect printer settings.

http://support.crystaldecisions.com/communityCS/FilesAndUpdates/printersettings.zip.asp
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 40 total points
Comment Utility
It may be this line that is causing the problem of getting the PRINT CANCELLED displayed.

     CommonDialog1.CancelError = True

mlmcc
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 13

Accepted Solution

by:
EwaldL earned 45 total points
Comment Utility
currently i can't see the link between your common dialog and the report. try hardcoding the values first such as
crReport.SelectPrinter "drivername", "printername", "port"
from (http://support.crystaldecisions.com/library/kbase/articles/c2003560.asp)

if you are in cr 9, then also set the paper orientation
http://support.crystaldecisions.com/library/kbase/articles/c2012124.asp
0
 

Author Comment

by:asmit8
Comment Utility
I figured it out...thanks for all your help!
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
And the answer is?

mlmcc
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now