Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2014
    Posts
    7

    Unanswered: How to make a command button open specific hyperlinks in table fields

    Hello, first time post: I've searched the previous threads and not found an answer which addresses my question directly. Hopefully there is sufficient detail below without blurring the question.

    In an Access 2007 database form I want a command button to open specific/unique ID hyperlinks from a table field (within the database). Each form page displays unique ID entry from a table and the hyperlinks are specific to the form page/table entry. The hyperlink is not to a generic document but specific to each primary key ID table field entry that is being viewed in the form. The hyperlink opens documents located in a separate file store.

    I have explored using the Expression Builder in Access but it appears it can only link to an Object in the database and not the table field entry specific to the data you are viewing on the form page.

    Is the only way to achieve what I want by using SQL? I know very little about writing SQL so I would need help and any suggested SQL to achieve the command button function I want would be appreciated.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    See: http://www.dbforums.com/microsoft-ac...yperlinks.html and replace references to the Label control to references to a Command button control.
    Have a nice day!

  3. #3
    Join Date
    Mar 2014
    Posts
    7
    Sinndho, thanks for the reply - I've had a look at the link you provided. It will take me a while to understand this and try it out but I will get back with a post on how it went.

  4. #4
    Join Date
    Mar 2014
    Posts
    7
    Unfortunately following the instructions in the linked previous post proved beyond me. In the end, the solution I arrived at was to keep the text/hyperlink boxes but make them invisible on the form. I then added the following code to the command button pointing to the hyperlinks:

    Private Sub nameofcommandbutton_Click ()
    If Me. [nameofcontrolsource]. Value = "" Then
    MsgBox "Error: Reference path is blank"., vbCritical
    Else
    FollowHyperlink Me. [nameofcontrolsource]. Value
    End If
    End Sub

    I doubt it is best solution but one I was able to understand (just) and does open specific data as you move through individual records via the form.

    I now can't work out how to display data from a link table in a listbox on a form. However I will open it in a separate post if I cannot find an existing suitable answer on the forum.

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Thanks for the feedback!
    Have a nice day!

  6. #6
    Join Date
    Mar 2014
    Posts
    7
    Not a problem at all and thanks for your suggestion. I'll try to revisit the solution in the pasted link at a later date but I need to take a dedicated SQL course at some point in order to understand it, otherwise it is litetrally like another language to me at the moment

Tags for this Thread

Posting Permissions

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