Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Location
    Cleveland USA
    Posts
    184

    Unanswered: How to display PDFs in an Access form?

    I am using Access 2007. Access 2007 has the Attachment field type, but you can't display PDFs, just a handful of image files, so that won't work for me.

    I want to display PDFs in a subform for the users. A given record can have zero, one or multiple associated PDFs. I don't want to store them inside the database because it'll bloat with thousands of PDFs. I think I'm supposed to use some type of OLE Object. Bound or Unbound? How do I get the PDFs to display? I've already got a text field to store the full path, but I don't know what to do next. Help! I've been searching for answers all morning to no avail.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You need to find an ActiveX control that can be included in an Access Form and that is able to display a document in pdf format. I looked around and it does not seem to be easy to find one, at least for free.
    Have a nice day!

  3. #3
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    I did this very same thing. I just added the "Adobe PDF Reader" ActiveX control that was on my machine from installing the free Adobe Reader.

    After I added the control to a form I added this code to a button that I used to load the file.

    Code:
    AcroPDF7.LoadFile (FullPathNameToFile)
    AcroPDF7.setShowToolbar (True)
    AcroPDF7.setView ("Width")
    The setview property sets up how the pdf is zoomed in the control...in this case it's setup to zoom to width.

    Hope this helps. Let me know if you have any questions.

    C

  4. #4
    Join Date
    Aug 2003
    Location
    Cleveland USA
    Posts
    184
    Thanks. I got it to work by using this code on the form's OnCurrent event:

    sPath = Me!txtOfficial_Drawing
    With Me![olePicture]
    .Locked = False
    .Enabled = True
    .Class = "AcroExch.Document.8"
    '''' Specify type of object.
    '''.OLETypeAllowed = acOLELink
    ' Specify source file.
    .SourceDoc = sPath
    ' Specify data to create link to.
    '''.SourceItem = ""
    ' Create linked object.
    .Action = acOLECreateLink
    ' Adjust control size.
    .SizeMode = acOLESizeZoom
    End With

  5. #5
    Join Date
    Aug 2003
    Location
    Cleveland USA
    Posts
    184
    Now, my next problem is getting this to work on the report. The report contains all the data fields for a particular record, and then displays the PDF(s), one per page. I've created a subreport for the PDFs, but none of the events seem to happen, so I don't know how to get the code to activate, either this code or Canupus' idea.

    Anyone have any ideas?

  6. #6
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    I have never tried to add the PDF file "into" a report. If you are looking for which event in the report to use you could always try the Format or Print event of the Detail section.

    Don't know if it will work. Good luck.

    C

  7. #7
    Join Date
    Aug 2003
    Location
    Cleveland USA
    Posts
    184
    It's me again. {sigh}

    So I got the form working fine. I'm using an Unbound Object Frame using the code I posted on 10/18. It works OK, except the quality of the PDF is very degraded, to the point where it's unreadable. I've tried switching between clip, zoom and stretch, but it doesn't help. Is there a setting to keep the PDF file quality intact when displaying and printing the form?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •