Code:
Public Sub ExportRpt_Click()Dim App As Object, AVDoc As Object, AForm As Object
Dim TODA As String, FNames As String, Rev As String, FT As String, Path As String, js As String, js1 As String, js2 As String
On Error GoTo Err_Handler
TODA = DLookup("[TODA]", "[QryTAR]")
FNames = DLookup("[FNames]", "[QryTAR]")
Rev = DLookup("[Type]", "[QryTAR]")
FT = DLookup("[FTCode]", "[QryTAR]")
Set App = CreateObject("Acroexch.app")
App.Show 'Hide
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AForm = CreateObject("AFormAut.App")
Path = "C:\TEMP\" & "0009TAR(" & FNames & ")(" & TODA & ")(" & [FT] & ")" & Rev & "_" & TOD & ".pdf"
If Me.[WCostComp] = True Then
DoCmd.OutputTo 3, "RptCostComp", acFormatPDF, "C:\TEMP\" & "CostComp(" & FNames & ")(" & TODA & ")(" & [FT] & ")" & Rev & "_" & TOD & ".pdf", , 0
End If
On Error Resume Next
DoCmd.OutputTo 3, "RptTAR", acFormatPDF, "Path, , 0"
If AVDoc.Open(Path, "") Then
js = "f = this.addField(""SignatureField"", ""signature"", 0, [26,174,243,134]);" & "f.value = ""TPOC""; " & " f.flatten"
AForm.Fields.ExecuteThisJavaScript js
js1 = "f = this.addField(""SignatureField1"", ""signature"", 0, [267,174,483,134]);" & "f.value = ""PM""; " & "f.flatten"
AForm.Fields.ExecuteThisJavaScript js1
js2 = "f = this.addField(""SignatureField2"", ""signature"", 0, [534,174,750,134]);" & "f.value = ""COR""; " & "f.flatten"
AForm.Fields.ExecuteThisJavaScript js2
End If
Path = Left(Path, Len(Path) - 4) & "s.pdf"
AVDoc.Save 1, Path
' Set App = Nothing
' Set AVDoc = Nothing
' Set AForm = Nothing
' Path = ""
Exit_Proc:
Exit Sub
Err_Handler:
MsgBox "Error: " & Err.Number & " - " & Err.Description
Resume Exit_Proc
End Sub