Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to Create a PDF file from a MS Access Report

Posted on 2016-11-14
10
Medium Priority
?
60 Views
Last Modified: 2016-11-15
I am using Access 2016 and I need to create a pdf file from an Access Report.
The name of the report is "rptCreditCardAuthorization"

Thanks
0
Comment
Question by:pcalabria
[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
  • 5
  • 3
  • 2
10 Comments
 
LVL 35

Accepted Solution

by:
Norie earned 1000 total points
ID: 41887071
Manually you can select the report, right click, select Export>PDF or XPS, select the folder to export to, enter an appropriate file name and click Publish.

If you want code here's the general syntax.
Dim strPath As String
Dim strFileName As String

    strPath = "C:\Test\" ' change as required
    strFileName = "Credit Card Authorization Report.pdf" ' change as required

    DoCmd.OutputTo acOutputReport, "rptCreditCardAuthorization", acFormatPDF, strPath & strFileName

Open in new window

0
 

Author Comment

by:pcalabria
ID: 41887081
Seems to work great with 2016.

Will the Access 2K compiled version of this file work on our Access 2000 machines?

Currently the code is in Access 2016 using Access2K format (.MDB).

I need to get the code running on our Access 2K machines as an .MDE file. The plan was to use an Access 2K machine to compile.
0
 
LVL 35

Expert Comment

by:Norie
ID: 41887097
If you are developing across multiple versions you should do the development in the earliest version that will be used, in this case Access 2000.

Unfortunately, as far as I recall, Access 2000 doesn't have a straightforward way to export/output to pdf so the code I posted isn't going to work.

Is there any other file format that could be used in place of PDF?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:pcalabria
ID: 41887213
None that I know of.  We have no control over what type of machine or fonts the customer has.

Will the code that you provided work if I create an executable in A2016 and the. Use the free runtime on the older computers?
0
 
LVL 35

Expert Comment

by:Norie
ID: 41887310
I don't think it will as exporting to PDF wasn't available in Access 2010.

You could give it a try with a small sample database - I'd do that myself but I don't currently have a machine with Access 2010 installed.
0
 
LVL 22

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 1000 total points
ID: 41887328
for Access 2000, use this free tool from Lebans:

http://www.lebans.com/reporttopdf.htm
0
 

Author Comment

by:pcalabria
ID: 41887430
Thanks everyone!

I wasn't sure how to handle the points because Norie completely answered by question as posted, although I wasn't able to use here solution in my A2K databases which I neglected to mention.

Crystal ultimately provided a solution for the A2K databases, although I have not determined whether this code will work in my  A2016 databases. (Ugh... two sets of code).

With this said I appreciate your help very much.

calabria
0
 

Author Comment

by:pcalabria
ID: 41887434
Thanks everyone!

I wasn't sure how to handle the points because Norie completely answered by question as posted, although I wasn't able to use here solution in my A2K databases which I neglected to mention.

Crystal ultimately provided a solution for the A2K databases, although I have not determined whether this code will work in my  A2016 databases. (Ugh... two sets of code).

With this said I appreciate your help very much.

calabria
0
 

Author Closing Comment

by:pcalabria
ID: 41887436
Thanks everyone!

I wasn't sure how to handle the points because Norie completely answered by question as posted, although I wasn't able to use here solution in my A2K databases which I neglected to mention.

Crystal ultimately provided a solution for the A2K databases, although I have not determined whether this code will work in my  A2016 databases. (Ugh... two sets of code).

With this said I appreciate your help very much.

calabria
0
 
LVL 22
ID: 41888784
you're welcome

> "determined whether this code will work in my  A2016 databases. (Ugh... two sets of code)"

you can test the access version and execute code accordingly.
http://allenbrowne.com/ser-53code.html#GetFileFormat

You will want to user conditional compilation so there are not errors compiling
    #If VBA7 Then             '  Code is running in the new VBA7 editor 
      #If Win64 Then          '  Code is running in 64-bit version of Microsoft Office 
        'statement(s)
      #Else                   '  Code is running in 32-bit version of Microsoft Office 
        'statement(s)
      #End If 
    #Else                     ' Code is running in VBA version 6 or earlier 
      'statement(s)
    #End If

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

604 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