I need to embed a PDF file into my DB. Based on the client's business rules I cannot maintain the document outside of the DB. I cannot therefore link to a given location outside of the database.
The code that I am using, which I have confirmed from several different sites, is as follows:
------- Code used ----------------------------------------
varFile = "C:\PDFForms\ImportedFile.pdf"
On Error GoTo Error_cmdOleAuto_Click
Forms![PDFForm]![DocTypeID] = 13
Forms![PDFForm]![DocSubject] = "My new PDF document"
With Forms![PDFForm]![embeddedDoc]
.Enabled = True
.Locked = False
.OLETypeAllowed = acOLEEmbedded
.Class = "AcroExch.Document"
.SourceDoc = varFile
.Action = acOLECreateEmbed <-- Error generated here
End With
DoCmd.RunCommand acCmdSaveRecord
----------- Errors received --------------
?cstr(err)
2777
?Err.Description
The class argument in the CreateObject function of the Visual Basic
procedure you're trying to run is invalid.
---------------------------------------
I receive the listed errors when running this code.
All of the examples listed on all of the searches I have performed so far point me to the use of a .JPG or other image. These work comfortably, but the PDF file gives problems.
I have tried ignoring the .CLASS argument, but it still returns errors.
I have searched the current forums and find that similar questions to this have been posed by other members, but have also gone unanswered.
Please refer to:
There are a heap of other discussions, but most tend to recommend saving the document outside of the DB.
Has anyone solved this problem yet?
Can someone please advise me on this one?
The code that I am using, which I have confirmed from several different sites, is as follows:
------- Code used ----------------------------------------
varFile = "C:\PDFForms\ImportedFile.pdf"
On Error GoTo Error_cmdOleAuto_Click
Forms![PDFForm]![DocTypeID] = 13
Forms![PDFForm]![DocSubject] = "My new PDF document"
With Forms![PDFForm]![embeddedDoc]
.Enabled = True
.Locked = False
.OLETypeAllowed = acOLEEmbedded
.Class = "AcroExch.Document"
.SourceDoc = varFile
.Action = acOLECreateEmbed <-- Error generated here
End With
DoCmd.RunCommand acCmdSaveRecord
----------- Errors received --------------
?cstr(err)
2777
?Err.Description
The class argument in the CreateObject function of the Visual Basic
procedure you're trying to run is invalid.
---------------------------------------
I receive the listed errors when running this code.
All of the examples listed on all of the searches I have performed so far point me to the use of a .JPG or other image. These work comfortably, but the PDF file gives problems.
I have tried ignoring the .CLASS argument, but it still returns errors.
I have searched the current forums and find that similar questions to this have been posed by other members, but have also gone unanswered.
Please refer to:
- http://www.access-programmers.co.uk/forums/showthread.php?t=104988
- http://www.access-programmers.co.uk/forums/showthread.php?t=103410&highlight=ole+pdf
There are a heap of other discussions, but most tend to recommend saving the document outside of the DB.
Has anyone solved this problem yet?
Can someone please advise me on this one?