Solved

Document Prints after Pressing the Cancel Button in the Print Dialog Box

Posted on 2001-06-09
5
639 Views
Last Modified: 2012-08-14
Welcome any ideas.

I am using VB6.0 with crystal reports.  After displaying a crystal report and then opening the print dialog box and the user decides not to print the document, finally the user presses the cancel button to cancel the print dialog box, the document (the Crystal Report) still prints.  Is there anyway to get around this?  

If not, request code and explanation of the code to create a print dialog box in VB.  

Thanks
0
Comment
Question by:BirdsOfFire1
  • 2
  • 2
5 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 50 total points
ID: 6172780
There is a way to get around it.  Unfortunately you cannot use the default printer select form which doesn't communicate with VB.

You must develop your own printer control form and then return the button selection to the VB call and test if CANCEL was pressed.

I have a form for doing that at work and can put the code in on Monday.

good luck
mlm
0
 
LVL 4

Expert Comment

by:mcoop
ID: 6172788

Examine the CancelError property in the COmmon Dialog control.   This property allows you to trap the CANCEL button - as an error -  if the user backs out of the dialog.

A common misconception is that 'Cancel' is processed automatically by the control - this is incorrect!  You must explicitly set the CancelError property to TRUE, and have an error handler in place to catch the event.
0
 

Author Comment

by:BirdsOfFire1
ID: 6172818
To:  mlmcc

I appreciate any help you can give me on developing my own printer control and then return the button selection to the VB call and test if CANCEL was pressed.

Thanks.  I'll be waiting.


 
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6177843
I have a sample program that includes my Printer_Control form available.  Unfortunately I cannot post it on my web page from work.  I will put it there tonight and provide a link to it in my next response.

If you would like the sample before then send me your e-mail and I will e-mail it to you.

good luck
mlmcc
0
 

Author Comment

by:BirdsOfFire1
ID: 6179326
To:  mlmcc

This may reach you after work, if not, my e-mail address is:  BirdsOfFire@Juno.com.


BirdsOfFire1
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

21 Experts available now in Live!

Get 1:1 Help Now