Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with the Common dialog control 1

Status
Not open for further replies.

RickBerem

Programmer
Jan 18, 2001
156
CA
Hi,
In an Access 97 vba code, I use a common dialog to show the "printer" screen where my users can select the printer they want to print their reports. my problem is that I can't handle the situation where the user presses the CANCEL button on the "printer" form shown by the common dialog control.

is there a way to do that?

thanks

RickBerem
 
Set the CancelError property of the Common Dialog to True. It will raise an error when the user clicks on cancel and you can handle it with the err Object.


cdlg.CancelError = True
On Error Resume Next
cdlg.ShowPrinter
If Err.Number = 32755 Then MsgBox ("Cancel")

If everything was ok the err.number is 0. Any other number is another error. (Try err.description)

CU
Thomas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top