Solved

CommonDialog Cancel Button

Posted on 1998-10-14
2
401 Views
Last Modified: 2008-03-06
OK, I'm sure its easy but I'm having trouble being able to tell if the user has pressed the Cancel button in the Printer Commondialog box.
Thanks,
Mike
0
Comment
Question by:qdsinc
2 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 50 total points
ID: 1439964
Try this code:

Private Sub cmdPrint_Click()
   
    On Error GoTo err_cmdPrint_Click
    cdlgPrint.CancelError = True
    cdlgPrint.ShowPrinter
   
exit_cmdPrint_Click:
    Exit Sub
err_cmdPrint_Click:
   
        Select Case Err.Number
       
            Case cdlCancel
                MsgBox "User Cancelled"
                Resume exit_cmdPrint_Click
            Case Else
                MsgBox Err.Number & " - " & Err.Description, vbInformation, "An unexpected error"
                Resume exit_cmdPrint_Click
        End Select
Exit Sub

0
 

Author Comment

by:qdsinc
ID: 1439965
It worked, thanks alot.

Mike
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…

773 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