?
Solved

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

Posted on 2001-06-09
5
Medium Priority
?
673 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 101

Accepted Solution

by:
mlmcc earned 150 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 101

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

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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.
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…
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…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

840 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