Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Crystal Reports Cancel Printing with Visual Basic 6.0

Posted on 2005-04-02
Medium Priority
Last Modified: 2013-11-25
I am using VB 6.0 and Crystal Reports 10 RDC.

I am using the PrinterSetup method and can not figure out how to tell if the user pressed 'cancel' or not.

Here is my code:

      objReport.PrinterSetup (Me.hWnd)
      If (not cancel) then    
          objReport.PrintOut False
           MsgBox "Cancel Print"
      End If

Is there something I am missing?


Question by:wrightph
  • 2
LVL 12

Expert Comment

by:Bob Lamberson
ID: 13690379
Use avariable to hold a value returned by the users action, then evaluate that as (not cancel).

something like     variable = objReport.PrinterSetup (Me.hWnd)
I don't use CR so I'm not sure if that is right way to get user response, but the concept should work.


Author Comment

ID: 13690393
Thanks, Bob

I tried that but it appears that the report object doesn't return any variable -- that I am aware of.

LVL 12

Expert Comment

by:Bob Lamberson
ID: 13690420
Is there a property of the objReport object that you can query?

Like objReport.UserPressedCancel
LVL 13

Accepted Solution

vidru earned 500 total points
ID: 13699402
Use the PrinterSetupEx method, which returns a 1 if the user cancelled, or otherwise a 0:

If Report.PrinterSetupEx(Me.hWnd) = 1 Then
    MsgBox "Cancelled"
    Report.PrintOut False
End If


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

571 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