One button, multiple hyperlinks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewtoAccess
    New Member
    • May 2007
    • 32

    One button, multiple hyperlinks

    I have many Visio diagrams. There is 1 Diagram per SITE.

    I have a LISTBOX1 which lists all sites.
    After selecting a site in listbox1, I would like to have a BUTTON1 that opens up the appropriatte Hyperlink to a visio diagram for the particular site on the listbox.

    LISTBOX1 gets data from SITE table (SITEID is the primary key)
    Hyperlinks are:
    \\S01cspr01\cor pshare\MDF\site 0.vsd
    \\S01cspr01\cor pshare\MDF\site 1.vsd
    \\S01cspr01\cor pshare\MDF\site 2.vsd
    \\S01cspr01\cor pshare\MDF\site 3.vsd
    \\S01cspr01\cor pshare\MDF\site 4.vsd

    Private Sub Button1_Click()
    On Error GoTo Err_Button1_Cli ck




    Exit_Button1_Cl ick:
    Exit Sub

    Err_Button1_Cli ck:
    MsgBox Err.Description
    Resume Exit_Button1_Cl ick

    End Sub

    Thanks for your help.
  • JConsulting
    Recognized Expert Contributor
    • Apr 2007
    • 603

    #2
    Originally posted by NewtoAccess
    I have many Visio diagrams. There is 1 Diagram per SITE.

    I have a LISTBOX1 which lists all sites.
    After selecting a site in listbox1, I would like to have a BUTTON1 that opens up the appropriatte Hyperlink to a visio diagram for the particular site on the listbox.

    LISTBOX1 gets data from SITE table (SITEID is the primary key)
    Hyperlinks are:
    \\S01cspr01\cor pshare\MDF\site 0.vsd
    \\S01cspr01\cor pshare\MDF\site 1.vsd
    \\S01cspr01\cor pshare\MDF\site 2.vsd
    \\S01cspr01\cor pshare\MDF\site 3.vsd
    \\S01cspr01\cor pshare\MDF\site 4.vsd

    Private Sub Button1_Click()
    On Error GoTo Err_Button1_Cli ck




    Exit_Button1_Cl ick:
    Exit Sub

    Err_Button1_Cli ck:
    MsgBox Err.Description
    Resume Exit_Button1_Cl ick

    End Sub

    Thanks for your help.
    you can use the followhyperlink command as your onClick event

    followhyperlink me.mylistbox.co lumn(x)

    that is, if this "\\S01cspr01\co rpshare\MDF\sit e0.vsd" is what's in the column

    Comment

    • NewtoAccess
      New Member
      • May 2007
      • 32

      #3
      The Listbox value is used for other functions on the same form, so I cannot dedicate its functions to only Hyperlinks.

      Thanks for the advice.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Originally posted by NewtoAccess
        The Listbox value is used for other functions on the same form, so I cannot dedicate its functions to only Hyperlinks.

        Thanks for the advice.
        I'm just confused by your response. There's no mention of dedicating the listbox's function to hyperlinks in Jconsulting's solution nor is there a need to.

        Comment

        • JConsulting
          Recognized Expert Contributor
          • Apr 2007
          • 603

          #5
          Originally posted by NewtoAccess
          The Listbox value is used for other functions on the same form, so I cannot dedicate its functions to only Hyperlinks.

          Thanks for the advice.
          so the value IS the \\path\file...e tc ?

          Comment

          • NewtoAccess
            New Member
            • May 2007
            • 32

            #6
            I got it working, Thanks

            Private Sub ViewFloorPlan_C lick()
            On Error GoTo Err_ViewFloorPl an_Click

            Dim stAppName As String
            If Me![List0] = "250" Then
            FollowHyperlink ("\\S01cspr01\c orpshare\MDF\Ca rteret\Verizon_ Cage.vsd")
            ElseIf Me![List0] = "31" Then
            FollowHyperlink ("\\S01cspr01\c orpshare\MDF\16 33 Broadway\48Floo r\MDF Floor Layout.vsd")
            ElseIf Me![List0] = "32" Then
            FollowHyperlink ("\\S01cspr01\c orpshare\MDF\Ne w Rochelle\NR_Lay out.vsd")
            End If

            Exit_ViewFloorP lan_Click:
            Exit Sub

            Err_ViewFloorPl an_Click:
            MsgBox Err.Description
            Resume Exit_ViewFloorP lan_Click

            End Sub

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              It's be better for you to just include an extra invisible column in the listbox that holds the link information.

              Comment

              • NewtoAccess
                New Member
                • May 2007
                • 32

                #8
                Not sure how to do that, but will try.

                Comment

                Working...