473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Duplex Printing - From VBA

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
8 17064
NeoPa
32,556 Expert Mod 16PB
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
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
32,556 Expert Mod 16PB
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
8,834 Expert 8TB
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
32,556 Expert Mod 16PB
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
8,834 Expert 8TB
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
32,556 Expert Mod 16PB
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
8,834 Expert 8TB
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

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

Similar topics

0
by: manofbluz | last post by:
I have two complex Word templates that also contain some Bookmarks for receiving database data dynamically. I'm using Word automation code within VB.NET to manipulate the template. I don't need to...
4
by: manofbluz | last post by:
I have two complex Word templates that also contain some Bookmarks for receiving database data dynamically. I'm using Word automation code within VB.NET to manipulate the template. I don't need to...
0
by: dchu | last post by:
Does anyone know how to set printer duplex using browser control (i.e SHDocVw.InternetExplorer) in vb.net without the need to used system.drawing.printing class. Any Guru here?????????????? who...
0
by: dchu | last post by:
Hi, Any idea on how to set duplex mode, I am using web browser control to print html document and send directly to default printer.
0
by: KohlerTommy | last post by:
In my application I need to give the user the ability to print duplex if the selected printer supports duplex printing. Many of the printer options do not make much sense in my application, and...
4
by: Jamey Shuemaker | last post by:
I've been looking for a way to do a duplex print job without a duplex printer. I reviewed some old posts about printing odd pages and found that most of them led to KB article 101075 or an export...
10
by: Joe M | last post by:
I was wondering if someone could lend me a hand with a C# problem I am having I am trying to use the “setPrinter” api to change the duplex setting (under printing preferences on printer...
0
by: Net | last post by:
Hi, Anyone can tell me how I can set the VB program to do duplex printing automatically? What I have now is: oDoc = oWord.Documents.Open(filepath) oDoc.PrintOut(Background:=False,...
2
by: =?Utf-8?B?SlA=?= | last post by:
Hi, We have an application that is written in Visual Studio .Net but the reports will not duplex while printing? Does anyone have an idea why? Thanks, -- JP
1
by: dotnetdummy | last post by:
Hi, Can anyone who can help me out if possible. At the moment, I'm working on a window application (vb.net) which print out html document's through a default network printer. I'm using...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.