Results 1 to 9 of 9
  1. #1
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234

    Hyperlink in subform not working

    I have subform with a hyperlink, but although it acts like a hyperlink (mouse pointer changes to the finger pointing thing), when clicked, nothing happens. I know I need to create an "On click" event procedure, but I'm not doing it right.

    Can someone help me out?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    what about CTL-click? did you try that?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Is this a Hyperlink type field or just a text field with url string? Or is this just a command button? Are you using FollowHyperlink? Post your code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I believe it is a hyperlink type field; I selected "yes" for the "is hyperlink" property. Not a command button. And there is no code written for that box that I'm aware of. The control source is a column in the employee table, and it's a valid hyperlink. If I copy it and paste it into an address bar, it works.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Selecting Is Hyperlink Yes does not make it a hyperlink type field. Hyperlink field would be defined in table design. Setting Is Hyperlink Yes on a textbox bound to a text field just makes the text look like a hyperlink although it really isn't. Requires code to make the string work like a hyperlink. That's what FollowHyperlink is for. However, it doesn't always seem to work. Example from my db:

    Private Sub btnLink_Click()
    On Error GoTo ErrProc
    'FollowHyperlink is not working properly
    ''Application.FollowHyperlink Me.tbxLink
    Dim wsShell As Object
    Set wsShell = CreateObject("WScript.Shell")
    wsShell.Run Chr(34) & Me.tbxLink & Chr(34)
    Me.Title.SetFocus
    ExitProc:
    Set wsShell = Nothing
    Exit Sub
    ErrProc:
    MsgBox "Cannot open document. Contact database administrator. : " & Err.Number
    End Sub

    A button has a HyperlinkAddress property - no code is needed, just click the button.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Makes sense. So what code would I write for Private Sub txtDocument_Click() to give it the best chance of working? I tried DoCmd.FollowHyperlink, but "FollowHyperlink" isn't an option for DoCmd.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    I show the code in my example. It is the commented line:

    Application.FollowHyperlink Me.tbxLink

    https://msdn.microsoft.com/en-us/lib...or=-2147217396
    http://allenbrowne.com/func-GoHyperlink.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I'm getting an error message when I click it saying "Compile error: Method or data member not found"

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Me.tbxLink is reference to textbox on my form. Use your textbox name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Hyperlink from subform issue
    By vad77 in forum Forms
    Replies: 2
    Last Post: 03-06-2014, 07:48 AM
  2. Replies: 22
    Last Post: 05-06-2013, 11:39 AM
  3. Replies: 4
    Last Post: 10-08-2012, 05:33 PM
  4. Hyperlink on a subform?
    By yes sir in forum Access
    Replies: 23
    Last Post: 10-08-2010, 05:38 PM
  5. Open up url page hyperlink not working!
    By riffraff_ashraf in forum Forms
    Replies: 1
    Last Post: 09-29-2010, 09:33 AM

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