Results 1 to 3 of 3
  1. #1
    Siuxia is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    6

    Duplex Printing

    Hi, I have setup a report in a DB application to duplex print through VBA, although this application is going to be deployed at another site and I want to make sure of something.
    The code I have deployed is as follows


    Code:
    strReport = "rptJobSheet"
    
    DoCmd.OpenReport strReport, acViewPreview, , "JobNumber = " & txtJobNumber
    Reports(strReport).Printer.Duplex = acPRDPHorizontal
    Reports(strReport).Printer.PaperBin = acPRBNAuto
    I have tested this on a Simplex printer I have access to and it seems to just print out on 2 pages which is good, but I want to save hassle later down the line plus for my own knowledge I was wondering if there is a bit of code that will query the duplex functionality of the default printer and give me a true or false as to whether it can duplex or not. Any ideas as have drawn a blank.
    Last edited by Siuxia; 09-05-2012 at 01:48 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try:
    Code:
    Option Compare Database
    Option Explicit
    'http://msdn.microsoft.com/en-us/library/bb258176.aspx
    'Declaration for the DeviceCapabilities function API call.
    Private Declare Function DeviceCapabilities Lib "winspool.drv" _
        Alias "DeviceCapabilitiesA" (ByVal lpsDeviceName As String, _
        ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _
        ByVal lpDevMode As Long) As Long
    'DeviceCapabilities function constants.
    Private Const DC_BINNAMES = 12
    Private Const DC_BINS = 6
    Private Const DEFAULT_VALUES = 0
    Public Const DC_DUPLEX = 7
    
    Public Sub DetectDuplexCapability()
    With Application.Printer
    If DeviceCapabilities(.DeviceName, .Port, DC_DUPLEX, ByVal vbNullString, 0) <> 0 Then
        Debug.Print "Has duplex"
        'g_blnDuplexAvailable = True
    End If
    End With
    End Sub
    I have not verified if this code reports duplex capability because the mechanical duplexing unit is actually in place or simply that the printer is designed to accept one.

    I am not sure what the results I get from the DeviceCapabilities function indicate.
    3 Konica printers (all have duplexer installed) and gINT PDF Exporter return 1
    XPS Document Writer and Adobe PDF return 0
    Office Document Image Writer returns -1

    Also review
    http://toddmcdermid.blogspot.com/200...d-printer.html
    http://www.xtremevbtalk.com/showthread.php?t=119582
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Siuxia is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    6
    That works perfectly so far, will have to test at the other site and see how it goes.
    Thanks very much

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Duplex Printing
    By Dale S in forum Reports
    Replies: 2
    Last Post: 05-31-2012, 09:01 AM
  2. Printing
    By mrkaye in forum Reports
    Replies: 12
    Last Post: 09-11-2011, 07:20 PM
  3. Printing Problems
    By combine21 in forum Reports
    Replies: 1
    Last Post: 10-28-2010, 10:52 AM
  4. Printing!!!!
    By Kipster1203 in forum Access
    Replies: 7
    Last Post: 05-14-2010, 08:58 AM
  5. Help with my printing
    By mattwill2001 in forum Queries
    Replies: 4
    Last Post: 08-17-2009, 01:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums