Results 1 to 10 of 10
  1. #1
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16

    Hyperlinks on a Subform not working correctly!

    Hi All,



    I have a subform with a txt field called "ApptNo". The field is a 'hyperlink' derived from a table called "Appointments". I changed the table field from a 'short txt' to a 'hyperlink' after I built the form and realized I needed a link to the actual appointment.

    On the subform property sheet, I answered 'Yes' as to "Is Hyperlink".

    I want the user to click on the "ApptNo" and hyperlink to the actual appointment.

    I used the "GO Hyperlink" function by Allen Browne and created a stand-alone module. Then, behind the event "on-click" property of the "ApptNo" field I added, "Call GoHyperlink(Me.[ApptNo])
    "End Sub"

    Problem: I get a potential security concern error that asks if I want to continue. I say yes, and then it says, "Error 490: cannot find specified file". However, if I right-click and open the hyperlink--the document will open.

    Note: My hyperlink docs all use a "#" in the document name. EX: Appt #78 (2011). However, I did change the appointment name to "Appt 78 (2011)" to no avail.

    Thank you in advance for your help!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    If the field truly is a Hyperlink type and the content is structured like a hyperlink, the GoHyperlink function (which actually uses the intrinsic FollowHyperlink() function) should not be needed.

    The # character would definitely be an issue.

    All Allen Browne's code does is scrub a string to make sure it is a valid hyperlink and then executes the FollowHyperlink() function.

    If you want to use function to open document, the field could have remained a text type.

    Exactly what 'document' are you opening - PDF?
    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.

  3. #3
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16
    The document is the specific appointment document. They are all .pdf(s). I want to allow the user to pick which one they want, and just click on it to open it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    My comments still apply. I don't know why your code fails. Would have to debug. Refer to link at bottom of my post for debugging guidelines.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  5. #5
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16

    DB is attached (hopefully, 2nd attempt)

    Thank you for your time, June.
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I've never used Allen's GoHyperlink in my db. I just tested and it constructs a string like:

    78#file:///MVR.JPG%23#
    (I replaced one of the hyperlink references in record with a file on my computer)

    That is the content of strLink variable. I used step debugging with a breakpoint so I could set the content of the variable in the VBA immediate window to:
    C:\Temp\MVR.JPG

    Then I allowed the code to continue execution with that string and the document opens in my default internet browser (IE).

    I think you can just switch this field back to a text type, clean up the data so the field just has the appointment number. Set the textbox DisplayAsHyperlink property to Always.

    Then call FollowHyperlink directly:

    FollowHyperlink("C:\Temp\" & Me.ApptNo & ".pdf")

    Use whatever file path prefix is appropriate.
    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.

  7. #7
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16
    Where do I put the call? Immediately after the code, "Call GoHyperlink (Me.[ApptNo})?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    It would be instead of GoHyperlink. So delete or comment that line.

    This assumes the appointment number is the name of the corresponding PDF.
    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.

  9. #9
    NGFLNG1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2014
    Posts
    16
    Hi June,

    OMG, I was making this way harder than it should have been. I didn't even need all that programming and it works fine.

    Here is what I did (for the others):

    In the 'Appointments' table, I made ( or kept) the field 'ApptNo' a hyperlink datatype.

    On the form: 'ApptNo' field property-- Display as Hyperlink: 'Always' and Is Hyperlink: 'Yes'
    In form view, I right click on the "ApptNo" and edited the location of the hyperlink.

    But I did need to remove the '#' sign from my appt no. to work properly.

    Thank you again...I will mark as 'Solved'.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Post 2 did advise the code shouldn't be needed if the field truly is a hyperlink type.
    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. Condtion not working correctly
    By hawkins in forum Access
    Replies: 3
    Last Post: 09-07-2011, 02:59 PM
  2. Replies: 5
    Last Post: 03-17-2011, 06:21 AM
  3. Replies: 0
    Last Post: 01-27-2011, 09:58 AM
  4. Split Form not working correctly
    By Brian62 in forum Access
    Replies: 29
    Last Post: 02-16-2010, 05:43 PM
  5. Replies: 1
    Last Post: 03-31-2008, 09:53 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