Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Texas, USA
    Posts
    374
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Hyperlink Field (2002)

    I want to use one field to store PDF file by hyperlink. The following is the value of the field in one record for explanation. The 13 is the ID number of this record. The rest, D:dataMyDocs .pdf, is the same for every record. Is there a way to put the ID number and the "D:dataMyDocs .pdf" together and hyperlink it in a field?

    D:dataMyDocs13.pdf

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hyperlink Field (2002)

    I don't think you can do this in a query, but you can simulate it on a form, by using FollowHyperlink. For example, in the On Click event procedure of a (locked) text box bound to ID:

    Application.FollowHyperlink "D:dataMyDocs" & [ID] & ".pdf"

    You could make the text blue and underlined to resemble a hyperlink.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Texas, USA
    Posts
    374
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Hyperlink Field (2002)

    Hi Hans,

    I create a Text Box in the Detail section and add your expression codes into the OnClick event as following. But, when I click on this new text box, an error message comes out.
    Attached Images Attached Images

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hyperlink Field (2002)

    I meant that you should create an event procedure, i.e. Visual Basic code.

    Clear the On Click box, then select Event Procedure from the dropdown list.
    Next, click the Builder button (the three dots ... to the right.)
    You will be taken to the Visual Basic Editor. Access has already created the first and last line of the event handler:

    Private Sub Expr1_Click()

    End Sub

    The blinking cursor is positioned in the blank line between them. Press the Tab key once, then enter the line of code

    Application.FollowHyperlink "D:dataMyDocs" & [ID] & ".pdf"

    where you must replace ID by the actual name of your ID field. Now, switch back to Access, and test if it works OK.

  5. #5
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Texas, USA
    Posts
    374
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Hyperlink Field (2002)

    Hi Hans,

    Thanks for the detailed instruction. After I changed it to event, the click did bring out the hyperlinked file. But the path was not shown inside the text box. What are the codes needed to show the path inside the text box?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hyperlink Field (2002)

    Set the Control Source property of the text box to ="D:dataMyDocs" & [ID] & ".pdf"

  7. #7
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Texas, USA
    Posts
    374
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Hyperlink Field (2002)

    Hans,

    Only a little annoying issue on this solution. The D:dataMyDocs" & [ID] & ".pdf value will be displayed at the last one record which has the * mark. Is there a way to avoid this?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hyperlink Field (2002)

    You can test whether ID is null (empty):

    =IIf(IsNull([ID]),Null,"D:dataMyDocs" & [ID] & ".pdf")

Posting Permissions

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