Fill PDF from from Access VBA
Hi All
I have a PDF form that is I am trying to automate and fill in from an Access Database. I have been working on this for a couple of weeks. I was able to find a solution that will work from Excel VBA:
The problem that I am having is that part of the solution I need uses the word "Form" which is a restricted word in MSAccess. Does anyone know how I would be able to properly automate this from MSAccess VBA - and not Excel VBA
The issue is the line of code that Starts with jso.xfa.form...... - as I mentioned the word Form is restricted - so while I understand that this is a Livecycle designed form (not by me) - since the fields I am trying to update a Check kboxes - the jso.getfield.... code does not work.
Any assistance would be greatly appreciated
Thanks
Jeff
Here is my Code:
Sub Test()
Dim FileNm, gApp, avDoc, pdDoc, jso
Dim FileNm2
FileNm = "C:\HSAR_DB\WAR\HOIR.pdf"
FileNm2 = "C:\HSAR_DB\WAR\HOIR3.pdf"
Set gApp = CreateObject("AcroExch.app")
Set avDoc = CreateObject("AcroExch.AVDoc")
If avDoc.Open(FileNm, "") Then
Set pdDoc = avDoc.GetPDDoc()
Set jso = pdDoc.GetJSObject
'THIS LINE WORKS IN BOTH EXCEL AND ACCESS
jso.getfield("LAB1070_E[0].Page1[0].txtF-3_Time[0]").Value = "1130"
'THIS LINE WORKS IN EXCEL BUT NOT ACCESS
jso.xfa.form.LAB1070_E.Page1.DSBInj.rawValue = "1"
pdDoc.Save 1, FileNm2
avDoc.Close (True)
Set gApp = Nothing
Set avDoc = Nothing
Set pdDoc = Nothing
Set jso = Nothing
End Sub()
