Results 1 to 2 of 2
  1. #1
    d-mcc56 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    16

    Print Button with Landscape as Default

    Hey all,

    So I'm working on a form that was created to someone who worked here previously.
    There is a button on it that prints the current record.
    Code:
    Private Sub Button204_Click()
    On Error GoTo Err_Button204_Click
    
    
    
    
        DoCmd.DoMenuItem A_FORMBAR, A_EDITMENU, A_SELECTRECORD_V2, , A_MENU_VER20
        DoCmd.PrintOut A_SELECTION
    
    
    Exit_Button204_Click:
        Exit Sub
    
    
    Err_Button204_Click:
        MsgBox Error$
        Resume Exit_Button204_Click
    End Sub
    That is the code for the print button.
    I was curious if there was a way to edit this code so that the form record would print in landscape orientation rather than portrait?



    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Print a report, not form. Set page orientation in the report from the Page Setup tab on ribbon.

    Otherwise, need code that manipulates the printer object, can get messy. An example where I control duplexing and destination bin:
    Code:
    strPrinter = Application.Printer.DeviceName
    ...
    'open report in preview mode because is only way to change bin and/or printer destinations without changing report saved setup
    DoCmd.OpenReport strReport, acViewPreview, , "Submit.ProjRecID=" & rsSampleInfo!ProjRecID & " AND Submit.DateEnter=#" & rsSampleInfo!DateEnter & "#", acWindowNormal, strRDC
    If strPrinter Like "*Konica*" Then Reports(strReport).Printer.Duplex = acPRDPSimplex
    If Not strRDC Like "*X" And strPrinter Like "*Konica*" Then
        'Set the report destination bin to lower tray to print on yellow paper
        Reports(strReport).Printer.PaperBin = acPRBNLower
    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.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-12-2014, 12:49 PM
  2. Print button quick print
    By xtrareal22 in forum Reports
    Replies: 1
    Last Post: 12-11-2013, 11:21 AM
  3. Print to Default Printer
    By bsc0617 in forum Access
    Replies: 7
    Last Post: 10-10-2013, 07:46 AM
  4. Replies: 0
    Last Post: 02-22-2011, 05:04 AM
  5. Automating changing Report Print Set-up to Landscape
    By Neil Bingham in forum Reports
    Replies: 0
    Last Post: 12-07-2009, 06:24 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