Results 1 to 4 of 4
  1. #1
    Charity is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2016
    Posts
    2

    Question Hyperlink on Subform Triggering On Close Event on Main Navigation Form?

    Hi All.. I'm hoping someone might be able to help me.

    I have a standalone database (not yet split) with about 5 users. The database is used for issue tracking and reporting (one issue per record on a main table). I've utilized a Navigation Form with a sub form in which the data entry occurs.
    The other sub forms are being utilized for reporting.

    Originally, it was requested to store supporting documentation (emails/excel docs/pdfs) for the issues in an attachment field within the main table. But then it was decided to change the attachment field to a hyperlink in order to save space.

    I've been able to do this successfully; however, when the hyperlink is clicked (from the subform) and opens the File Window, it triggers an OnClose event that I have in the Main Navigation Form.

    The OnClose command on the Main form is running an update query that populates the users logout time (as the close button on the main navigation form is disabled - and would only trigger when they closed the database).. so NOW when users click the hyperlink, it is causing the logout time to update prematurely. I've tried putting this command on the login form, and hiding it... but it is still triggering the OnClose event on any form I put it in..

    I'm seriously puzzled by this. What is the hyperlink doing that is triggering all form OnClose events?

    The sub form field that houses the hyperlink is a text box. I have written a public function that is being triggered by a command button.. It creates a folder for new records, and populates the hyperlink to the folder in the text box. I don't see anything in the function that would cause this..

    This is the public function:

    Code:
    Public Function CreateFolder()
    Dim fs, cf, x
    Dim strFolder As String
    Dim newFolder As String
    
    On Error Resume Next
    
    strFolder = "\\COLFSX\SHARE\CIA DOCUMENTATION\CIA ISSUE LOG\ISSUE LOG DB DOCUMENTATION"
    newFolder = strFolder & "\CIA-" & [Forms]![Navigation Form].[NavigationSubform].Form.[IssueID]
    hl = strFolder & "\CIA-" & [Forms]![Navigation Form].[NavigationSubform].Form.[IssueID]
    
    If IsNull([Forms]![Navigation Form].[NavigationSubform].Form.[IssueID]) Then
       MsgBox "Cannot Create Folder for New Record"
       Else Set fs = CreateObject("Scripting.FileSystemObject")
                
       If fs.FolderExists(newFolder) = True Then MsgBox "'" & newFolder & "' already exists!"
       Else Set cf = fs.CreateFolder(newFolder)
                        
       If fs.FolderExists(newFolder) = True Then [Forms]![Navigation Form].[NavigationSubform].Form.[ATTACHMENTS] = "#" & newFolder
       
    DoCmd.Save
    
    MsgBox "'" & newFolder & "' successfully created!"
    
    Else MsgBox Err.Number & " " & Err.Description
       
    End If
    End If
    End If
    End Function
    .



    I'm not sure what is happening when the hyperlink is clicked, as there are no events in the text box its self. So, I'm not sure where to look to see what is happening when the hyperlink is clicked.

    Any help would be appreciated!

    Thanks in Advance
    Charity

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    On the Format Tab of the Properties Sheet for the Text box hyperlink, is it set Is Hyperlink Option = Yes.

    Add this to the OnClick of that text box:
    FollowHyperlink Me![Textbox], , True

    I used that and had a macro in the OnClose of the form and it did not trigger when I linked out to the folder dialog box.

    "CIA DOCUMENTATION\CIA ISSUE LOG" -- that's not you is it Hillary??

  3. #3
    Charity is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2016
    Posts
    2
    Hi There Bulzie Thanks for the quick response..
    Unfortunately, I'm not Hillary.. rofl!

    I have added the above-mentioned code and now I'm getting a Security Warning and a Macro error... UG!!! I hate Security Warnings.. Now I FEEL like Hillary.. lol

    Security Warning:
    A potential security concern has been identified.
    This Location may be unsafe.
    Hyperlinks can be harmful to your computer and data. To protect your computer, click only those hyperlinks from trusted sources.
    Do you want to continue?
    Yes or No

    When I click Yes I get:

    Runtime Error 7971
    Microsoft Access cannot follow the hyperlink

    When I click End on the run time error - It opens the link..

    I tried adding DoCmd.SetWarnings False - but no cigar

    On the bright side - its not triggering my OnClose event

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Not sure on the security issues. Maybe go to Trust Center and add the root folder location(check the box saying allow subdirectories) of where the files are going as a trusted location. Also not sure if it is something with using a text box but what about using a label instead of a text box? Can manipulate with:
    Me.Label4.HyperlinkAddress = "http:\\www.cnn.com"
    Me.Label4.Caption = "cnn"

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

Similar Threads

  1. Subform Navigation from main form
    By johnturpin in forum Forms
    Replies: 1
    Last Post: 03-20-2015, 11:40 AM
  2. Replies: 4
    Last Post: 11-06-2014, 05:35 AM
  3. Replies: 2
    Last Post: 11-28-2012, 10:32 AM
  4. Replies: 11
    Last Post: 11-10-2012, 03:00 AM
  5. Triggering a form event from a report
    By Paul H in forum Forms
    Replies: 2
    Last Post: 10-12-2012, 09:48 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