By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,292 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,292 IT Pros & Developers. It's quick & easy.

Duplex Printing - From VBA

P: 33
Well, I just solved a problem that would have taken most of you an hour in only 4 days! (And frankly, I'd be ashamed to show you how I did it.) Now, I'm in another bind.

The problem I have now is that the procedure which calls a report multiple times, based on data in a table will only print single-sided instead of duplex. I've read the VB help screen and can attest to the fact that it is in some form of English but not a form I can decipher.

I'd appreciate any help you could provide!

Thanks,
Shawn
Nov 13 '07 #1
Share this Question
Share on Google+
8 Replies


NeoPa
Expert Mod 15k+
P: 31,768
Shawn,

If you post the routine you currently have, and draw attention to the most relevant lines, then we'll see what we can do.
It's not an area I'm familiar with (as I always print manually myself), but with your code as a starting point we'll see what we can manage.
Nov 14 '07 #2

P: 33
Since posting the question I have found an answer that will work for us with one exception. Using the DoCmd.RunCommand acCmdPrint statement, the system apparently picks up the default printer specs and prints duplex. The problem I'm left with is that to meet the need, the same report might print 50 times (with different data, of course) and the command above opens the "Print" window and you have to hit "OK" for each report printed.

I tried the SetWarnings command, thinking it would work as I've used it in macros to keep from having to click OK everytime you update info in a table. It didn't work.

If someone knows how to turn the Print form off, I'd be very grateful if you could pass that info along!

Thanks,
Shawn
Nov 14 '07 #3

NeoPa
Expert Mod 15k+
P: 31,768
Since posting the question I have found an answer that will work for us with one exception. Using the DoCmd.RunCommand acCmdPrint statement, the system apparently picks up the default printer specs and prints duplex. The problem I'm left with is that to meet the need, the same report might print 50 times (with different data, of course) and the command above opens the "Print" window and you have to hit "OK" for each report printed.
As I said, I can only really progress from the starting point you give me. I don't think this approach can get you all the way, though it may be easier to get to where you're at this way.
I tried the SetWarnings command, thinking it would work as I've used it in macros to keep from having to click OK everytime you update info in a table. It didn't work.
As the name suggests, it's particularly for warning messages rather than all popups.
If someone knows how to turn the Print form off, I'd be very grateful if you could pass that info along!

Thanks,
Shawn
I'm sorry. I had a look and couldn't find anything that would allow you to control that.
Nov 15 '07 #4

ADezii
Expert 5K+
P: 8,699
Since posting the question I have found an answer that will work for us with one exception. Using the DoCmd.RunCommand acCmdPrint statement, the system apparently picks up the default printer specs and prints duplex. The problem I'm left with is that to meet the need, the same report might print 50 times (with different data, of course) and the command above opens the "Print" window and you have to hit "OK" for each report printed.

I tried the SetWarnings command, thinking it would work as I've used it in macros to keep from having to click OK everytime you update info in a table. It didn't work.

If someone knows how to turn the Print form off, I'd be very grateful if you could pass that info along!

Thanks,
Shawn
If you are using Access 2002 or greater, and your Printer is capable of Duplex Printing, how about programmatically changing the Duplex Mode for the specific Printer used for the Report as in:
Expand|Select|Wrap|Line Numbers
  1. Reports("<Your Report Name>").Printer.Duplex = acPRDPHorizontal
  2.                             OR
  3. Reports("<Your Report Name>").Printer.Duplex = acPRDPVertical
  4.                             OR
  5. Reports("<Your Report Name>").Printer.Duplex = acPRDPSimplex
  6.  
Nov 15 '07 #5

NeoPa
Expert Mod 15k+
P: 31,768
Nice one ADezii.
I found the predefined constants when I looked around for this but couldn't find where they were ever used :(
An alternative way of setting this then, if it's required dynamically and you don't want to change the saved report at all, would be in the OnOpen event procedure. From there you could say :
Expand|Select|Wrap|Line Numbers
  1. Me.Printer.Duplex = acPRDP???
Nov 15 '07 #6

ADezii
Expert 5K+
P: 8,699
Nice one ADezii.
I found the predefined constants when I looked around for this but couldn't find where they were ever used :(
An alternative way of setting this then, if it's required dynamically and you don't want to change the saved report at all, would be in the OnOpen event procedure. From there you could say :
Expand|Select|Wrap|Line Numbers
  1. Me.Printer.Duplex = acPRDP???
I like your way better, but just for your own information, I forgot a critical line of code in that if you want to programmatically modify the Duplex setting you must first Open the Report in Design Mode, preferably Hidden:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rptSomeReport", acViewDesign, , , acHidden
  2.  
  3. 'Set the Duplex Mode
  4.  
  5. 'Print Report
  6. DoCmd.OpenReport "rptSomeReport", acViewNormal, , , acWindowNormal
Nov 15 '07 #7

NeoPa
Expert Mod 15k+
P: 31,768
I would have thought that opening the report for design would amend the underlying report (thereby prompting the op to Save when it's closed). Am I off the mark here ADezii?
Nov 15 '07 #8

ADezii
Expert 5K+
P: 8,699
I would have thought that opening the report for design would amend the underlying report (thereby prompting the op to Save when it's closed). Am I off the mark here ADezii?
  1. The following code segment will Print rptShippers in Landscape Orientation, the Report will remain visible on the Screen, and once it is closed you will not be prompted to Save. The Orientation Mode will not persist, it will revert back to Portrait Mode.
    Expand|Select|Wrap|Line Numbers
    1. DoCmd.OpenReport "rptShippers", acViewPreview, , , acHidden
    2.   Reports("rptShippers").Printer.Orientation = acPRORLandscape
    3. DoCmd.OpenReport "rptShippers", acViewNormal, , , acWindowNormal
    4.  
  2. Interestingly enough, the following code segment also does not seem to Save the Orientation Mode of rptShippers:
    Expand|Select|Wrap|Line Numbers
    1. DoCmd.OpenReport "rptShippers", acViewPreview, , , acHidden
    2.   Reports("rptShippers").Printer.Orientation = acPRORLandscape
    3. DoCmd.OpenReport "rptShippers", acViewNormal, , , acWindowNormal
    4.  
    5. DoCmd.Close acReport, "rptShippers", acSavePrompt
    6. DoCmd.Close acReport, "rptShippers", acSaveYes
    7.  
Nov 15 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.