Results 1 to 4 of 4

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

Threaded View

  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

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