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
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
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

800 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