Solved

Need to Create a PDF file from a MS Access Report

Posted on 2016-11-14
10
40 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
  • 5
  • 3
  • 2
10 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 250 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 33

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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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 33

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 19

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 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 19
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 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