?
Solved

Need to Create a PDF file from a MS Access Report

Posted on 2016-11-14
10
Medium Priority
?
52 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 34

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 34

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 34

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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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