Results 1 to 11 of 11
  1. #1
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38

    Creating a hyperlink to open a pdf file


    I have a form, and on that form I have a textbox called RefDwgNo (user not allowed to make changes...just for viewing). Displayed in this textbox is the name of a file (without the .pdf extension). I changed the textbox to 'is hyperlink' and added to OnClick- this code:

    Private Sub RefDwgNo_Click()
    FollowHyperlink "\\***private***\engineering_data\***Private***\Des ign\Fitout\Label Plate\_LATEST REV"
    End Sub

    The user needs to actually open the .pdf file, not the folder its located in. How do I add the file name from this textbox to the code above?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I would not bother with the is hyperlink part. If the text box has the file name try:

    Code:
    Application.FollowHyperlink "\\***private***\engineering_data\***Private***\Design\Fitout\Label Plate\_LATEST REV" & Me.TextboxName & ".pdf"
    though the spaces in the path might screw it up.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe

    FollowHyperlink "\\***private***\engineering_data\***Private***\Des ign\Fitout\Label Plate\_LATEST REV" & Me.RefDwgNo.value & ".pdf"

  4. #4
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38
    I tried it with the .value and without. Neither worked. The spaces don't make a difference, I take out- & Me.refdwgno
    & ".pdf" and it worked, it just got me to the file holding the .pdfs
    Quote Originally Posted by ItsMe View Post
    Maybe

    FollowHyperlink "\\***private***\engineering_data\***Private***\Des ign\Fitout\Label Plate\_LATEST REV" & Me.RefDwgNo.value & ".pdf"

  5. #5
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38
    Anyone still paying attention to this thread.
    Quote Originally Posted by Jrw76 View Post
    I tried it with the .value and without. Neither worked. The spaces don't make a difference, I take out- & Me.refdwgno
    & ".pdf" and it worked, it just got me to the file holding the .pdfs

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I just posted some examples here
    https://www.accessforums.net/access/...tml#post209029

    Let us know if you are still having trouble.

  7. #7
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38
    still having trouble. I don't see anything wrong with the code, but for some reason adding: & Me.RefDwgNo & ".pdf" isn't being recognized.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Try hard coding the entire path and see if it opens the file. Make sure you've turned off the is hyperlink as it may be adding something extra.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Try this.. create a string variable. This way you can trouble shoot the variable before assigning it to the hyperlink.


    Code:
    Dim strPath as string
    strPath = "\\***private***\engineering_data\***Private***\Design\Fitout\Label Plate\_LATEST REV" & Me.TextboxName & ".pdf"
    debug.print strPath
    The debug line will print your string variable in the Immediate Window. You can view the immediate window using Ctrl+G on your keyboard. There you can study the hyperlink and see where there may need to be an adjustment. You can try pasting it in Windows Explorer. You could also paste it here and maybe we can see something.

  10. #10
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38
    got it...didn't have a backslash after the last folder on the path....thanks for the help. It was when hard coding it that I noticed it.

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    We have all been there before. It is not a bad idea to break procedures out into sections so they can be isolated and scrutinized. Glad you got it working!

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

Similar Threads

  1. Hyperlink string doesnt open file
    By tagteam in forum Access
    Replies: 7
    Last Post: 10-20-2013, 09:01 PM
  2. creating Automatic Hyperlink
    By zachir in forum Forms
    Replies: 1
    Last Post: 04-22-2013, 12:51 PM
  3. Open Access DB via a Hyperlink
    By Kirsti in forum Access
    Replies: 0
    Last Post: 09-06-2012, 04:45 PM
  4. Creating a Hyperlink
    By dwmackay in forum Forms
    Replies: 1
    Last Post: 09-11-2011, 06:58 PM
  5. Hyperlink to open a form
    By accessnewb in forum Access
    Replies: 12
    Last Post: 07-27-2011, 07:33 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