Solved

How do I merge data from access to a pdf form? I have other PDF related questions too.

Posted on 2006-11-01
7
1,369 Views
Last Modified: 2010-09-14

I'm familiar with Access, however, I know very little about PDFs, and how to merge Access data onto them. I'm currently using Access 2003 and Adobe Acrobat Professional 7.0. I would prefer not to purchase a 3rd party software if I don't have to.

Currently I have several stand alone Fillable pdf forms that the users fill out and save. What I want to do is prepolulate most of data for them from an Access database.  

Here are some of the questions I have:
1. How do I filter out just the record they want? Can you link a PDF to a parameter query?
2. If I have 50 records in my access table, how do I merge all 50 records to an exisiting pdf form? Like a Word mail merge.
3. Once the merge is complete, can you save the new merged pdf so that it is no longer attached to the database?

Thanks for all of your help. I appreciate it. Please include code samples if appropriate.  
0
Comment
Question by:NLGroup
  • 3
  • 2
7 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 17856806
Do all 50 records go into the forms creating 50 forms - if so, do you have a naming convention for them?

The code itself is not too difficult, and I'm guessing you keep a blank form as a master, populate with record 1 and save to a name, then loop to 2 etc....


Kelvin
0
 

Author Comment

by:NLGroup
ID: 17857476
Kelvin, thanks for your response.

I was thinking of just merging them and printing them. I had not thought about saving them.

Right now, my one PDF is linked to the table with the 50 records. I linked it with the Forms Designer. Can I just merge and print?
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 17861466
If you have the blank pdf with the fields on it, the you can, with the use of a bit of code, populate the fields and print them. In all cases where I've done it before, we had to keep a copy so, they we saved first. In that case, we even went as far as creating the field on a blank pdf, then populating them.

Kelvin
0
 

Author Comment

by:NLGroup
ID: 17865935
Do you have some sample code?
0
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
ID: 17869605
You need to set references to Adoble type libraries. When I did this last it was adobe 5.0 and they were set to the Adobe Acrobat 5.0 Type library  and AFormAut 1.0 Type library (in the Reader plugins folder somewhere)

Function would go something like this

Note thios piece of code was to add a new field - you may want to edit an existing field

    Dim PDDoc As CAcroPDDoc
    Dim formApp As AFORMAUTLib.AFormApp
    Dim acroForm As AFORMAUTLib.Fields
    Dim field As AFORMAUTLib.field
    Dim AVDoc As CAcroAVDoc
    Dim bOk As Boolean

    Set AVDoc = CreateObject("AcroExch.AVDoc")
    While Not bOk
        bOk = AVDoc.Open(sFileName, "")
    Wend
   
    Set PDDoc = AVDoc.GetPDDoc
    Set formApp = CreateObject("AFormAut.App")
    Set acroForm = formApp.Fields
   
    Set field = acroForm.Add(sFieldName, "text", 0, 0, 35, 510, 0)
    field.IsHidden = False
    field.Value = sFieldValue  'parameter with test field's data
    field.TextSize = "9"
    field.TextFont = "Arial"
       
    If Not PDDoc.Save(PDSaveFull, sFileName) Then
        MsgBox "Unable to Save the PDF file (" & sFileName & ")"
    End If
   
    If Not AVDoc.Close(True) Then
        MsgBox "Unable to close the PDF file (" & sFileName & ")"
    End If

ex:
    Set PDDoc = Nothing ' Free the called object
    Set formApp = Nothing
    Set acroForm = Nothing
    Set field = Nothing
    Set AVDoc = Nothing
    Exit Sub
er:
    GoTo ex
    Exit Sub


0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 35
sql statement - 9 25
Any Way to Print an Import Spec? 3 31
Access Update Query 1 20
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

810 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