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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Dialog opens TWO times?

Status
Not open for further replies.

waldemar

Programmer
Nov 15, 2001
245
DE
I have this menu entry in an access application, that is just opending the regular Print dialog:

=DoCmd.RunCommand(340)

However, after clicking ok, the dialog REappears a second time... Does anybody know, why? How I can avoid this behavior?
 
Nobody ever had this problem? How do you implement a Print Dialog?
 
Ahhh that was it.... I guess that known runtime error isnt handled by the menu onAction and (strangely) causes the print dialog to reappear a second time. Putting that whole thing into a 100% code function with error handling solved the problem.

Short for everybody having the same problem:

Instead of Inserting

=DoCmd.RunCommand acCmdPrint

into the Action Property of the Menu item

use

=printDialog()

and put

Function printDialog()
On Error Resume Next
DoCmd.RunCommand acCmdPrint
On Error GoTo 0
End Function

(or any nice error handling code) into a global module.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top