Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771

    Debug. Refer to link at bottom of my post for guidelines. Set breakpoint and step through code. Does the varFile variable get populated?

    I tested this code and had to make one change.

    GoHyperlink(Me.txtFile)
    Last edited by June7; 01-10-2014 at 01:50 AM.
    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.

  2. #17
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65
    I made the change to GoHyperlink(Me.txtFile) and when i choose a file using the dialog box the file opens straight away but the file path still does not appear in the text box. I tried using the debug thing but when i place the cursor at the start of the code and press F8, i just get a little chirp from the PC and nothing happens ? (not that i'd know what i'm looking at in any event)

    Thanks

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    It has to be putting the value in textbox, otherwise the code could not open the file.

    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.

  4. #19
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65
    Thanks i'm attaching the database. Can i just get the link to appear in the textbox without the file opening ?
    Attached Files Attached Files

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Certainly. Don't include the line that calls the GoHyperlink function.

    You have the field set as a hyperlink type. Your code is grabbing the filename as normal text. If you want to save it as a hyperlink, it needs to be structured like a hyperlink as described in the other Allen Browne article.

    The control is a listbox, not a textbox. Change it to a textbox.
    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. #21
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65
    Right i've changed the ListBox to a TextBox and removed the GoHyperlink line. Now when i select a file, the path appears in the textbox in blue but doesn't work as a link when i click it.
    I looked at Allen Browne's other article but i don't really understand a lot of it....sorry
    Attached Files Attached Files

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You want to save a hyperlink string and not use Allen Browne's GoHyperlink?

    A hyperlink is composed of 3 parts, separated by a # character. Depending what the hyperlink is for, not all parts require text but the # separators are required regardless. Use string manipulation to construct a hyperlink string.

    In your case, should be at least:

    Me.txtFile = "#" & varFile & "#"

    Allen's GoHyperlink function essentially does that, although not so obvious. Using Allen Browne's code will prevent the hyperlink warning popup.
    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. #23
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65
    That's it working now. I have the field in the table set as hyperlink, i'm not using the GoHyperlink code, and i've amended my code to what you suggested above. It now allows you to select a file and the file path is displayed in the textbox. You can then click on the hyperlink to open the file (No warning messages).
    Thanks for your patience with this June...i'm not very knowledgeable when it comes to VB. I appreciate you taking the time to get this working for me

    Emma x

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Interesting, you don't get the 'Hyperlinks are dangerous. Do you really want to open?' warning? Lucky you. Glad it's working.
    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.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-05-2013, 11:07 AM
  2. open hyperlink in form - using VB
    By ender in forum Programming
    Replies: 1
    Last Post: 02-17-2012, 04:14 AM
  3. Hyperlink to open a form
    By accessnewb in forum Access
    Replies: 12
    Last Post: 07-27-2011, 07:33 PM
  4. Replies: 4
    Last Post: 01-31-2011, 03:19 PM
  5. Form Variable in Hyperlink
    By russ0670 in forum Forms
    Replies: 5
    Last Post: 01-15-2010, 08:09 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