?
Solved

Export individual report to pdf

Posted on 2017-05-15
2
Medium Priority
?
82 Views
Last Modified: 2017-05-18
Dear Experts.

I have an Access 2007 database with 300 results from a survey, each of the 300 people surveyed answered a dozen questions which are being analysed.  

What I also need to do is produce a separate pdf report for each person surveyed (each person's results are between 1 to 2 pages in length) ie 300 different pdfs.

The results are all housed in a table called "FinalResults" and are fed through to the report from a query called "IndividualReportQuery".  The report itself is called "Individual Report" and there is a unique ID for each record called "ID" which is what I would like to use as the name for each pdf.

I have thought of exporting the whole report as a pdf & then use a pdf splitter, but each record can be 1 or 2 pages in length.

The only other way I was thinking was to somehow use a recordset clone ... basically create a query for the 1st record in the report (ie select all from XXX where ID = "123456") & use this as the dataset for the report.  Then export the report, once done then the last bit of vba would be to delete the newly created query and repeat this process 300 times.


Can anybody help or have other ideas of how to tackle this?

Many thanks
0
Comment
Question by:correlate
[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
2 Comments
 
LVL 39

Accepted Solution

by:
PatHartman earned 2000 total points
ID: 42135743
I'm a little pressed for time, so I'll give you pseudo code.

Change the report to reference a field on a form for criteria.  If you ever want to print all records, make the criteria optional

Where (someID = Forms!myform!myhiddensomeID  OR  Forms!myform!myhiddensomeID Is Null)

Open a query that selects the 300 people whose surveys you want to print
For each person in the query
    Me.myhiddensomeID = rs!someID
    sOutFileName = sOutFolderName & "somefixedportion" & Format(Date(), "yyyymmdd") & "_" & Me.someID & ".pdf"
    DoCmd.OutputTo acOutputReport, "reportname", acFormatPDF, "filename"
Next

The problem is caused because the OutputTo does not take a runtime Where argument similar to OpenReport and OpenForm so you have to work around the issue.  Another method is to open the report using the where argument and then print the report to the pdf but I find this method awkward and slower for large numbers of reports.
0
 

Author Closing Comment

by:correlate
ID: 42140640
Perfect, works a treat, thank you very much
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
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.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

649 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