Solved

Need to Create a PDF file from a MS Access Report

Posted on 2016-11-14
10
29 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
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 18

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 18
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views 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 Access…
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now