Results 1 to 7 of 7
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,396

    Force DoCmd.OpenReport to first present printer options before starting to print

    I have a report that requires the user be given the opportunity to override the default printer settings. Given my code:



    Code:
    DoCmd.OpenReport "rptBooklet", acViewNormal, , , , NumOnLastPage
    Are there additional parameters I can provide to allow overriding of printer defaults?

    (Note: I cannot process THROUGH PrintPreview, as PrintSection = False in the OnFormat is lost when the report is actually printed.)

    Thanks,
    Bill

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,950
    What settings do you want to override - just the destination?

    The only method I am aware of is to change the default printer before publishing the report then reset it back to the original default. http://www.kallal.ca/msaccess/msaccess.html
    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
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,396
    Yes, I've also concluded that the default printer properties have to be pre-set before publishing. (The report is to be published duplex and the report's RecordSource has been "compiled" accordingly.) I'll mark this post as "Solved", as I'm sure now that we're right about what's needed.
    Thanks,
    Bill

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,950
    Some printer properties can be controlled programatically. I set destination tray and duplex. Does require opening the report to PrintPreview first then use DoCmd.PrintOut method.
    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.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,396
    I'll look into that. As long as setting the duplex property DOES NOT leave that setting as the DEFAULT then it would be okay. To do otherwise leaves the client un-aware of a change they'd likely not appreciate.
    (I have to go to the client's office to test.)
    Bill

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,950
    Example:
    Code:
    strPrinter = Application.Printer.DeviceName
        DoCmd.OpenReport strReport, acViewPreview, , "Submit.LabNum='" & strLabNum & "'", acWindowNormal, strMode
        If strPrinter Like "*Konica*" Then Reports(strReport).Printer.Duplex = acPRDPSimplex
        Reports(strReport).Printer.PaperBin = acPRBNAuto
        If Not strRDC Like "*X" And strPrinter Like "*Konica*" Then
            'Set the report destination paper bin to Tray 2 to print on yellow paper
             Reports(strReport).Printer.PaperBin = acPRBNLower
        End If
        If strPrinter Like "*Konica*" And booPage2 = True Then
            Reports(strReport).Printer.Duplex = acPRDPHorizontal
        End If
        'print page 1 of report if not Konica printer, otherwise print full report to Konica
        If intView = vbNo Then DoCmd.PrintOut acPages, 1, IIf(booPage2 = True And strPrinter Like "*Konica*", 2, 1)
        If strPrinter Like "*Konica*" Then Reports(strReport).Printer.Duplex = acPRDPSimplex
        Reports(strReport).Printer.PaperBin = acPRBNAuto
        'print page 2 of report if there is one and not Konica printer
        If intView = vbNo And booPage2 = True And Not strPrinter Like "*Konica*" Then
            If Not strPrinter Like "*Konica*" Then MsgBox "Add paper or turn sheet over to print on reverse then click OK.", vbApplicationModal, "Print"
            DoCmd.PrintOut acPages, 2, 2, , IIf(strPrinter Like "*Konica*", 1, 2)
        End If
    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.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,396
    Thanks June, I learn something new every day.
    Bill

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

Similar Threads

  1. DoCmd.OpenReport WHERE condition
    By bidbud68 in forum Programming
    Replies: 16
    Last Post: 10-19-2012, 05:31 AM
  2. Need help w/ docmd.openreport
    By jwill in forum Reports
    Replies: 3
    Last Post: 06-04-2012, 09:49 PM
  3. Message box options not starting macro
    By iPete in forum Programming
    Replies: 1
    Last Post: 04-12-2012, 03:51 PM
  4. DoCmd OpenReport ... where condition with a Like
    By Grooz13 in forum Programming
    Replies: 4
    Last Post: 08-31-2010, 09:04 AM
  5. Can docmd.openreport print X copies on Y printer?
    By Coolpapabell in forum Reports
    Replies: 1
    Last Post: 09-02-2009, 08:35 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 - Senior Forums