Results 1 to 9 of 9
  1. #1
    Rasken is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5

    Create a link to open a PDF specific to each record

    All, I hope someone can help me....

    Its probably been 7-8 years since I did anything of substance in Access and even then my knowledge was limited just somehow got stuff to work. I am desperately trying to get something to work now in a new database (2010) and I just cant get it to work.....

    The who db is pretty simple, 1 table and 1 form. The table only has about 5 fields with one of them being a unique number. The form shows all the fields. Here comes the problem...

    In my form, I am trying to create a button that will open a Pdf file that resides in the same windows folder as the db. There are about 500 records each with their own pdf. The pdf are all named with the same number as the unique number field for each record [ID].

    NOW...if I create a hyperlink in the form and manual put the link w/file name into the link it work fine. For example, in the hyperlink property in the form if I put file://c:/docubase/3840.pdf the pdf opens fine

    BUT...I want the person who is going to be using this db to be able to just scan in the pdf and name it to unique number for that record and then save it to docubase. Therefore, I essentially want the hyperlink to do the following..... c:/docubase/[ID].pdf. Of course that doesnt work but I have tried just about every variation of that:

    file://c:/docubase/"&[ID]&".pdf
    file://c:/docubase/"+[ID]+".pdf



    Of course I got those suggestions from looking at every access help site/forum on the web. Ive seen a ton of information about using very complex code - but honestly I have absolutely no idea how to even begin with those. Will somebody please help me???

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Need to use the hyperlink dialog to save hyperlink value because a hyperlink actually has multiple parts or use code to build the parts. Review: http://www.allenbrowne.com/casu-09.html

    Run hyperlink with FollowHyperlink: http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

    or

    Run a simple string as a hyperlink: http://allenbrowne.com/func-GoHyperlink.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Rasken is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    I have the hyperlink and it works as long as I put the name of file I want into the link itself....ie file://c:/docubase/3840.pdf. Instead of putting the actual file name in, I want it to be tied to the "ID" field of each record.....ie file://c:/docubase/[ID].pdf What is the syntax to make that actually work?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What do you want to do? You want to construct hyperlink and save to hyperlink field? Or do you just want to open the PDF?

    Try FollowHyperlink - note the backslash:

    FollowHyperlink("c:\docubase\" & [ID] & ".pdf")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Rasken is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    I simply want to open up the PDF....It doesnt need to be part of the database.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Did you try suggestion?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Rasken is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    If I put

    Followhyperlink("c:\docubase\"&[id]&".pdf") in the "on click" property....

    I get

    If followhyperlink .... Is a new macro or macro group, make sure you have saved it and that you typed it correctly

    If I put in the hyperlink address propert field I get

    Unable to open followhyperlink cannot open the specified file

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    My suggestion is code that must be in VBA procedure (I don't know if macros can handle).

    So select [Event Procedure] in the Click event property, click ellipses (...) to open the VBA editor to the procedure, type code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Rasken is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    GOD BLESS YOU!!!!! It worked exactly the way I wanted! Thanks again

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-05-2013, 02:17 PM
  2. Open Form and Link To Specific Record
    By burrina in forum Forms
    Replies: 2
    Last Post: 12-17-2012, 11:09 PM
  3. Replies: 2
    Last Post: 10-08-2012, 12:39 PM
  4. Create a form that edits a specific record
    By winteram in forum Forms
    Replies: 10
    Last Post: 07-28-2011, 11:46 AM
  5. Open Specific Record
    By halfaguava in forum Forms
    Replies: 1
    Last Post: 06-09-2011, 04:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums