Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Select a printer from crystal viewer

Posted on 2003-11-30
6
Medium Priority
?
824 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
[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
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 120 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 101

Assisted Solution

by:mlmcc
mlmcc earned 120 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 13

Accepted Solution

by:
EwaldL earned 135 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 101

Expert Comment

by:mlmcc
ID: 9871748
And the answer is?

mlmcc
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

671 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