Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2001
    Posts
    45

    Question Unanswered: Why does the Print Dialog open TWO Times??

    I have this menu entry in an access application, that is just opending the regular Print dialog:

    =DoCmd.RunCommand(340)

    However, after clicking ok in the first print dialog, the dialog REappears a second time... Does anybody know, why? How I can avoid this behavior?

  2. #2
    Join Date
    Nov 2001
    Posts
    45
    Nobody ever had this problem? How do you implement a Print Dialog?

  3. #3
    Join Date
    Jul 2002
    Location
    Alexandria, VA (DC Metro Area)
    Posts
    5
    If it helps...from what I understand, the function that you're using to call the Print Dialog, DoCmd.RunCommand(340), is actually just executing the "Print" command in your file menu, just as if you had clicked it. You shouldn't have any additional code after that command that tries to modify the print action, because it will happen after the document has been sent to the printer.

  4. #4
    Join Date
    Nov 2001
    Posts
    45
    thanks, but its not even in the Code, just in the OnAction Property of that menu item.

  5. #5
    Join Date
    Nov 2001
    Posts
    45
    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


    into a global module.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •