• I spent a fair amount of time researching this very thing and trying all sorts of VBA code. I have successfully created code that will open a PDF and then insert data from Access into the form-fillable PDF. Getting code samples from Acrobat forums is extremely difficult. It's as if Acrobat programmers don't like to share code.

    That said, I've been wanting to share how I did it because I can't be the only one who needed this. Yes, Access can output to Word. Yes, Access can output a report as PDF. But what if the PDF is not your creation? What if you just need to populate it with data you have in your database?

    I am using Adobe Acrobat X Standard. I have a couple of ways I populate PDFs with data.

    1. pass an array of values to the procedure that populates the PDF and loop thru the array to insert the data

    2. use recordset and get data, then hard code the names of the PDF fields and populate them

    3. use a table to store the field mapping so that I can use a loop to populate the PDF fields with the corresponding Access data

    I work PT for an insurance brokerage so some of the forms I'm populating are called ACORD apps. You do NOT want to recreate these in Access so populating a PDF is 100x easier.

    I'm attaching a text file with the various code samples. It's all VBA code so it can be pasted into a new module. It will have to be modified quite a bit to meet your needs, but it's a start. Here's a basic sample:

    ' VERY BASIC EXAMPLE OF INSERTING DATA IN A PDF

    Public Sub PopulateCertHolder(ByVal sValue As String, ByVal sAcord As String, ByVal sSaveAs As String)

    Dim WshShell As Object

    On Error GoTo PopulateCertHolder_Error

    'open pdf fillable form

    1 Set WshShell = CreateObject("Wscript.Shell")

    2 WshShell.Run "Acrobat.exe " & sAcord

    'delay to let the form load completely

    3 PauseTime = 1

    4 Start = Timer

    5 Do While Timer < Start + PauseTime

    6 DoEvents

    7 Loop

    8 Set APP = CreateObject("Acroexch.app")

    9 Set AVDOC = CreateObject("AcroExch.AVDoc")

    10 Set AVDOC = APP.GetActiveDoc

    11 Set PDDOC = AVDOC.GetPDDoc

    12 Set jso = PDDOC.GetJSObject

    'populate fields

    Dim val As Variant

    18 Set x = jso.GetField("FormFieldName")

    19 val = sValue

    23 x.Value = val

    'save file

    31 PDDOC.Save 1, sSaveAs

    32 AVDOC.Close 1

    DoEvents

    33 APP.CloseAllDocs

    DoEvents

    34 APP.Exit

    'just in case window didn't close

    35 fCloseApp "AcrobatSDIWindow"

    'housekeeping on the way out

    36 Set APP = Nothing

    37 Set AVDOC = Nothing

    38 Set PDDOC = Nothing

    39 Set jso = Nothing

    Exit_PopulateCertHolder:

    Exit Sub

    PopulateCertHolder_Error:

    Call LogError(Err.Number, Err.Description, "AcrobatCode.PopulateCertHolder", Erl)

    Resume Exit_PopulateCertHolder

    End Sub

    Hope this helps!

    Diana