Results 1 to 5 of 5
  1. #1
    kev921hs is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    4

    Open website from list box

    All -

    I have a list box that lists companies with 7 columns of details. The 7th column is each company's web site. Its data type is Hyperlink. Is there any fairly simple way to make that an active link?

    Alternatively, I would be willing to put something in the On Double Click event that would fire off the website, if there is a way to do that. I'd rather not though because right now double clicking opens the Company record and I'd like to preserve that. If that is the better way to approach this problem, is there another Event I could use (I've always wondered if On Key Press can be used in this situation, but I don't know how to use it)?

    Any advice would help, thanks!

    -Kevin

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Here is What I have done. I have a table with 5 columns and the Fifth column is a Hyperlink Field Type. I have a form with a combo Box RowSource id Table1. I have place a Commoand button on the form with the following Code:

    Private Sub Command2_Click()
    On Error GoTo Err_Command2_Click
    Dim strhyperlink As String

    If IsNull(Me.Combo0) Then
    MsgBox "Please select a Address"
    Else


    strhyperlink = "http://" & Me.Combo0.Column(4)
    Application.FollowHyperlink strhyperlink

    End If

    Exit_Command2_Click:
    Exit Sub

    Err_Command2_Click:
    MsgBox Err.Description
    Resume Exit_Command2_Click

    End Sub

    This code gets the hyppelink for the name that I select and opens it.

    if this solves your problem mark the thread solved.

    find attached sample.

  3. #3
    kev921hs is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    4
    That helped, but didn't solve it.

    Our users input all websites with http://, so I removed the part of your code that appended that text.

    So I have:
    strhyperlink = Me.CO_NAME.Column(6)
    Application.FollowHyperlink strhyperlink

    And I get the error:
    "Microsoft Access can't follow the hyperlink to '#http://www.website.com/#' "

    Is there a way to extract the full address text without the # symbols?

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    The Following change in the code will extract the address without the "#".

    Dim strhyperlink As String

    If IsNull(Me.Combo0) Then
    MsgBox "Please select a Address"
    Else


    strhyperlink = Replace(Me.Combo0.Column(4), "#", "")

    Application.FollowHyperlink strhyperlink

    End If

    Exit_Command2_Click:
    Exit Sub

    Err_Command2_Click:
    MsgBox Err.Description
    Resume Exit_Command2_Click

    End Sub

    Mark the Thread solved.

  5. #5
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    is you problem solved if yes mark the thread solved.

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

Similar Threads

  1. Retrieving data on my website
    By kattys in forum Access
    Replies: 1
    Last Post: 04-27-2010, 05:02 PM
  2. Replies: 2
    Last Post: 02-26-2010, 08:14 AM
  3. Replies: 1
    Last Post: 06-04-2009, 07:43 AM
  4. Open form from a drop down list
    By ildanach in forum Forms
    Replies: 15
    Last Post: 05-21-2009, 05:40 AM
  5. Open Form with a drop down list box
    By Rinehart in forum Forms
    Replies: 0
    Last Post: 08-10-2008, 08:53 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