Results 1 to 4 of 4

Thread: Access report: switch printer and select tray before printing

  1. #1

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Access report: switch printer and select tray before printing

    Hello people.

    The idea behind the following code is to open a report HIDDEN, change it's printer and tray, then open the report again normally so it prints.

    Code:
    'open report hidden
    DoCmd.OpenReport stDocName, view:=acPreview, WindowMode:=acHidden, WhereCondition:="[NoPatient] = 8"
    
    'set new printer (this part works)
    Set Reports(stDocName).Printer = Application.Printers(strPrinterToUse)
    
    'set paperbin to manual feed (this also works)
    Reports(stDocName).Printer.PaperBin = 4
    
    'open report normally so it prints
    DoCmd.OpenReport stDocName, WhereCondition:="[NoPatient] = 8"
    So here's my problem: on the last line of code (OpenReport), the report will show on screen! It should be sent straight to the printer. I tried using acHidden and did some trial and error on parameters, I can't find it out. Is there something wrong with the way I open it the first time around?

    I'm happy it does select the desired printer and tray, but having the report (which is currently an invoice being printed out) pop out and show every time is somehow annoying.

    My code seems to be following quite well different articles I've read.

    Any help appreciated!

    Thanks!
    Last edited by Krass; Apr 8th, 2014 at 11:20 PM. Reason: Edit: it *DOES* print, but still will show on screen :(
    Chris

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Access report: switch printer and select tray before printing

    Have you tried putting this:

    Code:
    DoCmd.RunCommand acCmdPrint
    after the line where you set the paper bin?

  3. #3

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Re: Access report: switch printer and select tray before printing

    Thanks for your feedback.

    I did try this out, it brings up the dialog box for printing... While I'd want the user to have no interaction at all.

    Also tried acCmdQuickPrint (or something like that) but it ended up printing the form instead.

    Currently my app does work, but you can see that report 'flashing' before being printed. Not very nice...
    Chris

  4. #4
    Addicted Member 3com's Avatar
    Join Date
    Jul 2013
    Location
    Spain
    Posts
    253

    Re: Access report: switch printer and select tray before printing

    but you can see that report 'flashing' before being printed. Not very nice...
    http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx

    HTH

Posting Permissions

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



Click Here to Expand Forum to Full Width