Results 1 to 2 of 2
  1. #1
    hkimpact is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    2

    Multiple Reports to Single PDF


    Good morning everyone!

    I am working on a database for my company in Access right now and one of the Forms that I have created can generate a single PDF file based on a report. I would rather have this done another way though. I want a user to be able to select multiple checkboxes on the form, which will determine what reports the user needs. The next thing that it will need to do is take all these reports and generate a single PDF containing each one of these selected checkboxes.

    Any help would be great on what I need to do. I'm going to keep googling and looking at ways of doing this. There has to be a way of doing this I would think.

    Thank you in advance,
    Rick

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,600
    Each report will have to be saved as independent pdf then they can be merged. Need VBA reference to Adobe Acrobat 8.0 Type Library.

    Code from my project to merge pdfs
    Code:
    Sub BatchMergePDF()
    Dim fso As Object, SourceFolder As Object, SFolder As Object, SSFolder As Object, SSSFolder As Object, PDFile As Object
    'Relies on the Adobe Acrobat 6.0 Type Library
    Dim objCAcroPDDocDestination As Acrobat.AcroPDDoc
    Dim objCAcroPDDocSource As Acrobat.AcroPDDoc
    Dim i As Integer, booMerge As Boolean
    'Initialize the objects
    Set objCAcroPDDocDestination = CreateObject("AcroExch.PDDoc")
    Set objCAcroPDDocSource = CreateObject("AcroExch.PDDoc")
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set SourceFolder = fso.GetFolder("R:\Projects\LabReportsOLD\")
    For Each SFolder In SourceFolder.subfolders
        For Each SSFolder In SFolder.subfolders
            If SSFolder.Name <> "Soils & Aggregate" Then
                i = 1
                For Each PDFile In SSFolder.Files
                    If i = 1 Then
                        objCAcroPDDocDestination.Open SSFolder.Path & "\" & PDFile.Name
                    End If
                    If i > 1 Then
                        objCAcroPDDocSource.Open SSFolder.Path & "\" & PDFile.Name
                        objCAcroPDDocDestination.InsertPages objCAcroPDDocDestination.GetNumPages - 1, objCAcroPDDocSource, 0, objCAcroPDDocSource.GetNumPages, 0
                        objCAcroPDDocSource.Close
                    End If
                    i = i + 1
                Next
                objCAcroPDDocDestination.Save 1, SFolder.Path & "\" & SSFolder.Name & ".pdf"
                objCAcroPDDocDestination.Close
            Else
                For Each SSSFolder In SSFolder.subfolders
                    i = 1
                    For Each PDFile In SSSFolder.Files
                        If i = 1 Then
                            objCAcroPDDocDestination.Open SSSFolder.Path & "\" & PDFile.Name
                        End If
                        If i > 1 Then
                            objCAcroPDDocSource.Open SSSFolder.Path & "\" & PDFile.Name
                            objCAcroPDDocDestination.InsertPages objCAcroPDDocDestination.GetNumPages - 1, objCAcroPDDocSource, 0, objCAcroPDDocSource.GetNumPages, 0
                            objCAcroPDDocSource.Close
                        End If
                        i = i + 1
                    Next
                    objCAcroPDDocDestination.Save 1, SFolder.Path & "\Soils & Aggregate " & SSSFolder.Name & ".pdf"
                    objCAcroPDDocDestination.Close
                Next
            End If
        Next
    Next
    Debug.Print SFolder.Name
    Set PDFile = Nothing
    Set SFolder = Nothing
    Set SSFolder = Nothing
    Set SSSFolder = Nothing
    Set SourceFolder = Nothing
    Set fso = Nothing
    Set objCAcroPDDocSource = Nothing
    Set objCAcroPDDocDestination = Nothing
    End Sub
    Last edited by June7; 02-27-2013 at 04:36 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple connections to a single backend
    By shabbaranks in forum Access
    Replies: 1
    Last Post: 01-09-2012, 04:38 AM
  2. single form multiple database
    By sms2720 in forum Programming
    Replies: 7
    Last Post: 12-14-2011, 01:26 PM
  3. Single Form, Multiple Options
    By forrestapi in forum Forms
    Replies: 4
    Last Post: 06-30-2011, 07:09 AM
  4. Creating single lined lists from reports
    By trikosuave in forum Reports
    Replies: 4
    Last Post: 02-14-2011, 08:10 PM
  5. Single Record Reports (HELP)
    By bnckeye27 in forum Reports
    Replies: 1
    Last Post: 11-13-2009, 02:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums