Open PDF in Form (1 Viewer)

bonekrusher

Registered User.
Local time
Today, 02:27
Joined
Nov 19, 2005
Messages
266
Thought this could be useful. The following code will open a PDF inside a form.

Insert the PDF activeX control and name it "viewer".
Make sure you add the Adobe OLE reference ("adobe"), if not the code will be undefined.

Code:
Private Sub Command18_Click()
Dim AcroApp As CAcroApp
Dim AVDoc As CAcroAVDoc
Dim PDDoc As CAcroPDDoc
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AcroApp = CreateObject("AcroExch.App")
Set PDDoc = AVDoc.GetPDDoc
    
    
    Me.Viewer.loadFile ("C:\yourfile.pdf") 
    
End Sub
 

bonekrusher

Registered User.
Local time
Today, 02:27
Joined
Nov 19, 2005
Messages
266
Here it is cleaned up...

Code:
Private Sub Command1_Click()

Dim AcroApp As CAcroApp
Dim AVDoc As CAcroAVDoc
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AcroApp = CreateObject("AcroExch.App")
   
    
Me.viewer.loadFile ("C:\yourfile.pdf")

End Sub
 

jlarnold1961

Janan
Local time
Today, 04:27
Joined
Jan 30, 2006
Messages
1
bonekrusher said:
Thought this could be useful. The following code will open a PDF inside a form.

Insert the PDF activeX control and name it "viewer".
Make sure you add the Adobe OLE reference ("adobe"), if not the code will be undefined.

Code:
Private Sub Command18_Click()
Dim AcroApp As CAcroApp
Dim AVDoc As CAcroAVDoc
Dim PDDoc As CAcroPDDoc
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AcroApp = CreateObject("AcroExch.App")
Set PDDoc = AVDoc.GetPDDoc
    
    
    Me.Viewer.loadFile ("C:\yourfile.pdf") 
    
End Sub

How do you insert the PDF activeX control and name it "viewer" and add the Adobe OLE reference ("adobe")?

I've been looking and can't seem to find it anywhere that makes it work. This is exactly what I need for my database. Thanks for your help.
 

bonekrusher

Registered User.
Local time
Today, 02:27
Joined
Nov 19, 2005
Messages
266
In the form design, click insert>ActiveX Control>Acrobat Adobe ActiveX Control.

Right Click on it>properties...change name to "viewer".

Depending on what version of acrobat you have the name of the ActiveX Control might be different.

If you need help more help, let me know what version of Access and Acrobat you are using.

Bones
 

mrcateriv

New member
Local time
Today, 02:27
Joined
Dec 16, 2012
Messages
4
I have Access 2010 and cannot find the activex control for my form. What is the name of this control for 2010?
 

mrcateriv

New member
Local time
Today, 02:27
Joined
Dec 16, 2012
Messages
4
Thanks for the replies. I actually forgot about this post for I think I found a work around for what I was trying to do back then.

However, I'm back in this same situation now and the code listed above gives me the error code "Active X component cant create object". ALL reference library reference have been added.

Your help would be greatly appreciated.
 

Users who are viewing this thread

Top Bottom