|
-
Apr 8th, 2014, 11:15 PM
#1
Thread Starter
Hyperactive Member
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
-
Apr 9th, 2014, 09:24 AM
#2
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?
-
Apr 10th, 2014, 10:41 PM
#3
Thread Starter
Hyperactive Member
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...
-
Apr 13th, 2014, 05:27 AM
#4
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|