Results 1 to 4 of 4
  1. #1
    mcaha is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Location
    Texas
    Posts
    4

    Print and PDF button on a Report?

    I'm using Access 2016 and have created a report from a query with a parameter request. Is there any way to add a button to export the report to PDF? Or a Print button?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Do you mean you have a dynamic parameterized query as report RecordSource? This is a parameter input popup? I NEVER use dynamic parameterized queries and definitely not with input popup.

    Yes, buttons can have code to export or print. This would use the OpenReport and OutputTo and maybe even PrintOut methods. However, the input popup might cause issues.

    I use VBA to set report WHERE CONDITION argument when report is opened.
    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
    mcaha is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Location
    Texas
    Posts
    4
    June, so instead of creating a query with [parameter], you create a report off of the table with a Where Condition argument. Is this correct? If so, I need to research how to do this. I also have tried to code a few buttons but nothing has worked for PDF'ing or printing the report. One was close, but made the query parameter window pop open again. And still wouldn't print.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Report direct to printer like:

    DoCmd.OpenReport "reportname", , , "ID=" & Me.cbxID

    Code to open report and export to pdf like:

    DoCmd.OpenReport "reportname", acViewPreview, , "ID=" & Me.cbxID
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, "mypath/" & Me.cbxID & ".pdf", False
    DoCmd.Close acReport, "reportname", acSaveNo
    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. Can't Get Print Button on Report!
    By PATRICKPBME in forum Reports
    Replies: 4
    Last Post: 02-08-2017, 12:25 PM
  2. Print report command button
    By Stika in forum Reports
    Replies: 5
    Last Post: 12-21-2012, 05:56 PM
  3. Replies: 3
    Last Post: 09-11-2012, 07:01 AM
  4. Replies: 0
    Last Post: 02-22-2011, 05:04 AM
  5. Error in Print Report Button
    By Robert M in forum Reports
    Replies: 16
    Last Post: 09-23-2009, 03:08 PM

Tags for this Thread

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