1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access VBA FollowHyperlink to PDF document: Acrobat opens but then closes immediately

Discussion in 'Business Applications' started by Gregor1234, Mar 21, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. Gregor1234

    Gregor1234 Thread Starter

    Joined:
    Jun 3, 2004
    Messages:
    237
    In my Access database (Office 2003, Windows XP) each record is associated with a file somewhere on disk. Some of these files are MS Word files and some are PDF files.

    In the DB, the user has the option to click on a button to view the document.

    When the user clicks on "View Document, I use the
    Application.FollowHyperlink method to open the document file.

    This works well except in the case of one particular computer where Adobe Acrobat is installed (instead of the usual Adobe Reader).

    When I run the software on this computer, the Word document open correctly but when I try to FollowHyperlink to a PDF file, the document opens momentarily, then closes almost immediately. The document is in view for less than a second.

    There is nothing wrong with the PDF document itself. When opened in the normal way on this computer, Acrobat opens it properly with no warnings or dialogues.

    I am unsure whether the problem has anything to do with Acrobat versus Reader but it is the single difference that I can identify immediately. I will soon try this on other machines that also have Acrobat installed to see if the problem is the same on those machines.

    Any ideas?
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,694
    I don't think it has anything to do with Reader vs Acrobat as I only have Reader and it does exactly the same. To overcome this I use an OLE object for PDF files.
    I have created a similar database to yourself which opens most types of files including
    Excel, Word, PDF, Music, Video, HTM, HTML.
    It populates the Tables directly from a Folder/Directory either with all files of the type chosen or single files.
    It also has a "Text" search facility for looking in Doc, RTF, TXT, ASC, PDF and XLS files.
    You are welcome to a copy if you want.
    Perhaps you could evaluate it for me as I intend offering it or versions of it free on a few websites. I would like to know if it is useful or not.
     
  3. Gregor1234

    Gregor1234 Thread Starter

    Joined:
    Jun 3, 2004
    Messages:
    237
    I'm not sure I understand how you use an OLE object for PDF files and would like to learn.

    I would be happy to look at you database. Can you attach a Zip of it here?
     
  4. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,694
    Gregor, this is a copy of my Document management database.

    It is not finished yet as I still need to add a Search Form to search the Document Table for matches in Descriptions, Speciality and "Used for" fields etc.

    This came about after another poster asked if I new of any software that did this and I realised I really need this to keep control of the Access Databases that I have helped with over the last few years, there are now over 300 of them alone. I also have Excel Workbooks from here as well, along with various pieces of useful VBA code.

    I would very much appreciate any feedback that you or any else can give me as it is really just a group of ideas at the moment.
    Obviously any "business" oriented versions would not need "music" files etc.

    I forgot in the previous post that you can also store Web Links as well, but you have to copy and paste them in.
     

    Attached Files:

  5. Gregor1234

    Gregor1234 Thread Starter

    Joined:
    Jun 3, 2004
    Messages:
    237
    Sorry-

    I've been very busy of late and hadn't time to reply

    I opened your datasbase but I can't run the code. Apparently it requires quite a few libraries to handle all of the different types of files and I don't have quite a few of them.

    I do however get the idea behind it just by looking at the forms and code and I think the concept behind the DB is an interesting idea.

    As for opening PDF files, you appear to be storing them as objects and activating them with library routines. This is the sort of thing that I'm not sure I want to do. I've been given to understand (thought I've not tested it myself) that storing objects in tables requires significantly more space than storing the bytes of files. The customer want the DB to have as small a footprint as possible. In addition, and perhaps more importantly, I cannot ensure that the user will have any of the required libraries/library versions installed. They may have Acrobat or they may have Adobe Reader or may have some other PDF reader installed. Using the "Follow" method allows me to let the system resolve how to open the file (with the problems that that entails). If I use "Follow" the user can at least open the file manually if necessary as it is written to disk. If I use routines out of a specific library then they won;'t even be able to open the DB is the correct library/version is not present.

    Thanks anyway for the info. I will still be interested in taking a longer look at the code in your document management database.
     
  6. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    OBP, I used to have a copy of this (when you posted it before) and wanted to fiddle with it again, but the zip file is password protected, at least that's what my PC thinks.
     
  7. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,694
    Gregor, you only "store" one .pdf file and it gets over written by each new one.
    You should be able to set all of the library references to run it.

    slurpee, this version is a slightly later one than the previous post.
     

    Attached Files:

  8. Gregor1234

    Gregor1234 Thread Starter

    Joined:
    Jun 3, 2004
    Messages:
    237
    I see... I hadn't read far enough into the code to grasp that you only "stored" a file as it was being displayed.

    In the end, I opted for a different solution... I set up a different form with a Microsoft Web Browser control on it and use that to display the PDF file. This works well enough and again, it offloads the problem of exactly "how" to display the file to the system.
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/553491

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice