Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access printing shortcut in Ms Access

Posted on 2016-10-26
10
Medium Priority
?
88 Views
Last Modified: 2016-11-27
I have a report that I have set up a printing shortcut set up in the printing preferences that selects the bin , papersize and orientation.Can I use VBA to make the shortcut active when selecting the report and return the printer back to the previous setting when exiting the database
0
Comment
Question by:Svgmassive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 41861921
What is a "printing shortcut"?
0
 
LVL 39

Expert Comment

by:PatHartman
ID: 41862562
Access remembers certain printer settings for a report such as alternate trays.  You will need to test on several computers but shouldn't have to make any adjustments as long as they are using a similar printer.
0
 
LVL 31

Assisted Solution

by:Helen Feddema
Helen Feddema earned 1000 total points
ID: 41863926
Make a new printer item with the settings you wish, then use code like the following to temporarily switch to that printer, print the report, then switch back to the default printer:

Public Sub PrintToSpecificPrinter(strPrinter As String, strReport As String)
'Created by Helen Feddema 12-Feb-2010
'Last modified by Helen Feddema 12-Feb-2010

On Error GoTo ErrorHandler

   Dim prtCurrent As Printer
   Dim prtDefault As Printer
   
   'Save current default printer
   Set prtDefault = Application.Printer
   Debug.Print "Current default printer: " & prtDefault.DeviceName
   
   'Select a specific printer as new default printer
   Application.Printer = Printers(strPrinter)
   
   'Print the report
   DoCmd.OpenReport strReport
   
   'Set printer back to former default printer
   Application.Printer = prtDefault
      
ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number & "; Description: " & _
      Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Svgmassive
ID: 41865550
I am trying to change the paper and bin selection at the printing short cuts.
I have attached the jpeg.
thanks
printing_shortcuts.bmp
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 41865659
@Svgmassive
That is a printer specific feature, not something that can be controlled from VBA unless the printer company provides an API (which it probably doesn't).
0
 

Author Comment

by:Svgmassive
ID: 41865833
The problem I am having since i don't have admin rights the PDF is of a legal size paper and i need it to print from tray 3 and it doesn't do that from within ms access
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 1000 total points
ID: 41865968
Try this:
Private Sub cmdPrintReport_Click()

    Dim rpt As Report
    Dim prtr As Access.printer

    Set Application.printer = Nothing
    Set prtr = Application.printer

    ' set paper size
    prtr.PaperSize = acPRPSLegal
    ' set paper bin
    prtr.PaperBin = acPRBNLower

    ' open your report in hidden view to apply the settings
    DoCmd.OpenReport "rptYourReportName", acViewPreview, , , acHidden
    Set rpt = Reports!rptYourReportName
    
    ' Set the Printer property of the report to the
    Set rpt.printer = prtr
    
    ' open the report in normal view to print
    DoCmd.OpenReport "rptYourReportName", acViewNormal
    DoCmd.Close acReport, "rptYourReportName", acSaveNo
    
    ' cleanup
    Set Application.printer = Nothing

End Sub

Open in new window

0
 

Author Comment

by:Svgmassive
ID: 41866080
Hi MacroShadow that works for printing the report.I am trying to bulk print pdf files in a folder from within access and it doesn't chose the correct bin.I have to constantly go and select the right bin.

Thanks
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 41866083
How are you printing the PDFs?
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 41866248
Can you post your code?
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question