Private Sub cboShowForm_AfterUpdate()
Dim AcrApp As CAcroApp
Dim AcrDoc As CAcroAVDoc
Dim AcrForm As AFormApp
Dim AcrFields As AFORMAUTLib.Fields
Dim db As Database
Dim strPath As String
Dim strPDF As String 'pathname of PDF form to populate
Dim strFDF As String 'pathname of FDF file associated
with client
Dim blnFileFound As Boolean
Set db = CurrentDb()
strPath = "\\Server\c\MIRC Databases\"
strPDF = strPath & Me!cboShowForm & ".pdf"
strFDF = strPath & Me!ClientID & "_" & Me!cboShowForm &
".fdf"
Set AcrApp = CreateObject("CAcroApp")<-error occurs here
AcrApp.Show ^^^^^^^^^^^^^^^^^^^^^^^^
Set AcrDoc = CreateObject("CAcroAVDoc")
OpenFDF:
blnFileFound = AcrDoc.Open(strFDF, vbNullString)
If Not blnFileFound Then
Call CreateNewFDF(strFDF, strPDF)
Resume OpenFDF
End If
End Sub
Private Sub CreateNewFDF(strFDF As String, strPDF As String)
Dim FDFAcX As FDFACXLib.FdfApp
Dim FDFOutput As FDFACXLib.FdfDoc
Dim strFirstName As String
Dim strMiddleName As String
Dim strLastName As String
strFirstName = Me!ClientFirstName
strMiddleName = Me!ClientMiddleName
strLastName = Me!ClientLastName
Set FDFAcX = CreateObject("FdfApp.FdfApp")
Set FDFOutput = FDFAcX.FDFCreate
With FDFOutput
.FDFSetValue "First Name", strFirstName, False
.FDFSetValue "Middle Name", strMiddleName, False
.FDFSetValue "Last Name", strLastName, False
.FDFSetFile strPDF 'Associate FDF file with PDF file
.FDFSaveToFile strFDF 'Create FDF file on disk
.FDFClose 'Close FDF file
End With
Set FDFOutput = Nothing 'dereference FDF file
Set FDFAcX = Nothing 'dereference instance of FDF
application
End Sub
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Your CreateObject is trying to create the wrong object, it should be the
following:
Set AcroApp = CreateObject("AcroExch.App")
Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
Set AcroPDDoc = CreateObject("AcroExch.PDDoc")
etc.....
------------------------------
Chris Henson
Image Conversions & Management
Web : www.icmconv.com
Email: chr...@icmconv.com
------------------------------
>
> Set AcroApp = CreateObject("AcroExch.App")
> Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
> Set AcroPDDoc = CreateObject("AcroExch.PDDoc")
> etc.....
Thanks--I tried this and it works. There are a couple of things that
still annoy me, though. I have a button on my Access form that closes
Acrobat, but first saves the data in the open PDF form to an FDF file.
Thus I don't want users closing the Acrobat window themselves, since the
data will be lost. Is there some way I can disable the close button on
the document and application windows for Acrobat? I'm sure there's an
API call somewhere that does that, but I have no idea what it is.
Also, when I close Acrobat from within my application it displays a
dialog box asking the user if they want to save changes to the open PDF
document. This dialog is not just annoying, but dangerous since I don't
want the user saving *any* changes to the document. I thought I got rid
of it by changing my preferences to "Skip Editing Warnings", but while
this works when I start Acrobat from the desktop, the dialog box still
appears when I start Acrobat using Shell or Automation. How can I get
rid of it in my application? Finally, I messed around a bit with the
OpenInWindowEx method of the AVDoc object, but am too ignorant of what
all the parameters mean to get it to work. Is there a good example
somewhere? TIA.
I have had the same problem with Distiller ActiveX Lib. I can't tell
you why this worked for me but try this....
Set AcrApp = New CAcroApp, instead of your Set Acrapp=Createobject _
("CAcroApp")
I have no Idea why the createobject keyword doesn't work.. probably an
Adobe feature :) .
In article <7otaud$7vo$1...@nnrp1.deja.com>,
sende...@hotmail.com wrote:
> Set AcrApp = CreateObject("CAcroApp")<-error occurs here
> AcrApp.Show ^^^^^^^^^^^^^^^^^^^^^^^^
> Set AcrDoc = CreateObject("CAcroAVDoc")
>
> OpenFDF:
> blnFileFound = AcrDoc.Open(strFDF, vbNullString)
> If Not blnFileFound Then
> Call CreateNewFDF(strFDF, strPDF)
> Resume OpenFDF
> End If
>
> End Sub
>
> Private Sub CreateNewFDF(strFDF As String, strPDF As String)
>
> Dim FDFAcX As FDFACXLib.FdfApp
> Dim FDFOutput As FDFACXLib.FdfDoc
> Dim strFirstName As String
> Dim strMiddleName As String
> Dim strLastName As String
>
> strFirstName = Me!ClientFirstName
> strMiddleName = Me!ClientMiddleName
> strLastName = Me!ClientLastName
>
> Set FDFAcX = CreateObject("FdfApp.FdfApp")
> Set FDFOutput = FDFAcX.FDFCreate
>
> With FDFOutput
> .FDFSetValue "First Name", strFirstName, False
> .FDFSetValue "Middle Name", strMiddleName, False
> .FDFSetValue "Last Name", strLastName, False
> .FDFSetFile strPDF 'Associate FDF file with PDF file
> .FDFSaveToFile strFDF 'Create FDF file on disk
> .FDFClose 'Close FDF file
> End With
>
> Set FDFOutput = Nothing 'dereference FDF file
> Set FDFAcX = Nothing 'dereference instance of FDF
> application
>
> End Sub