Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / June 2004

Tip: Looking for answers? Try searching our database.

Ole PDF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fredrik - 28 Jun 2004 13:50 GMT
I want to do the following but can't get it working...

To the left a listbox with hundreds of productnumbers with approx. 10 columns.
To the right a ActiveX control where a pdf document is shown.

When clicking on the rows, the pdf document is shown IN the form. I do not want to open the PDF in a new window.

This function is important to scroll through the productnumbers and see the PDF drawing at the same time in the smaller window.

Please advise! Thanks/Fredrik Larsson
Ron Weiner - 29 Jun 2004 03:17 GMT
Fredrik

Frankly I did not want to reply to this request, but since no one else has
taken a shot, here goes.

This solution is nasty ugly, but I did get it to work (mostly).  Here goes

Create a new form and save it.  This form gets no controls or code.  We are
only gonna' use it as a container to display our PDF's.

Create another form and put a Subform Control (make its name sfrmForm2) on
it that uses the first form as its Source Object.  Add a list box control
(make its name lstFiles) whose row source is the unambiguous pathname to a
few PDF files.  In the Code module of this form go into Tools References and
make a reference to the "Adobe Acrobat X.0 Type Library" (where the X is a
number 4,5, or 6), then add the following code

Option Compare Database
Option Explicit
Dim AcroExchAVDoc As CAcroAVDoc

Private Sub Form_Load()
   Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set AcroExchAVDoc = Nothing
End Sub

Private Sub lstFiles_Click()
   Dim blnOK As Boolean

   On Error Resume Next                ' if is already closed Blow past
error
   AcroExchAVDoc.Close (False)

   ' Add another error handler here
   blnOK = AcroExchAVDoc.OpenInWindowEx(lstFiles.Value, _
       sfrmForm2.Form.Hwnd, AV_DOC_VIEW, True, 0, _
       PDUseBookmarks, AVZoomFitWidth, 0, 0, 0)

   If Not blnOK Then
           MsgBox "Can't open file: " & lstFiles.Value
   End If
End Sub

In a REAL application you are gonna have to have MUCH better error handling
that I have in this stripped down example.  Especially since there is so
much that can go wrong with this.  Also you better be prepared for a form
that takes forever to open.  Instantiating the Acrobat Document object can
take quite a bit of time.  And lastly I am just about positive that you will
HAVE to have the FULL Acrobat PDF product on the machine to run this code.
I do not think this will work with the free reader.

Well there you have it, I wish you luck.  Perhaps this will inspire one or
two of the really smart guys out there to come up with a better way to do
this.

Ron W

> I want to do the following but can't get it working...
>
[quoted text clipped - 6 lines]
>
> Please advise! Thanks/Fredrik Larsson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.