Solved

Need to Create a PDF file from a MS Access Report

Posted on 2016-11-14
10
43 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

840 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