Solved

Select a printer from crystal viewer

Posted on 2003-11-30
6
817 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
ID: 9848682
Is there a reference or component i'm missing or something?
0
 
LVL 3

Assisted Solution

by:kathmacmahon
kathmacmahon earned 40 total points
ID: 9849978
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
ID: 9850699
It may be this line that is causing the problem of getting the PRINT CANCELLED displayed.

     CommonDialog1.CancelError = True

mlmcc
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 13

Accepted Solution

by:
EwaldL earned 45 total points
ID: 9853071
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
ID: 9864825
I figured it out...thanks for all your help!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9871748
And the answer is?

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# InstallShiled - Multiple Projects 3 76
Crystal Reports - Trim Data 7 63
Conditional Page Breaks Based On Grouping 1 35
Field in crystal 2011 is being cut off. 9 41
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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