Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    garrod is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    6

    Question A potential Security Concern has been identified. HOW DO I TURN THIS OFF?

    I am using Access from Office 2019 and Windows 10
    I want to open PDF documents from an Access form
    I can open the documents however I always get an annoying pop up message:
    "Microsoft Access Security Issue"
    "A potential Security Concern has been identified"
    "This Location may be Unsafe"
    Although if I click 'Yes' to "Do you want to continue?" it does open the document


    Click image for larger version. 

Name:	Access Error Message.JPG 
Views:	46 
Size:	33.1 KB 
ID:	43743
    I have made all the correct selections in the Trust Centre
    I have made the document Folder a Trusted Location
    I have ticked 'Allow documents on a Network to be trusted'
    I have spend over one hour with Microsoft Support who were less than useless and could not offer any help.
    Can anyone please help or advise?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    Post 2 was moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    garrod is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    6
    Thanks for reply, I did check it but that message seems to refer to the database itself which is not the problem I am having. My problem is the opening of Hyperlinks. I still cannot solve the problem!

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Unless I totally missed the mark for whatever I read the problem was related to opening pdfs, some of which were hyperlinks. This security thing isn't due to Access - it's Windows.
    Adobe also has info on how to deal with the same issue.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    Unfortunately, the solution in the link given by Micron in post #3 doesn't work - the security message still appears.
    However, I do have a solution that works perfectly using a default file handler instead of FollowHyperlink.
    There is no need to modify the registry.

    Copy the following into a standard module e.g. modHandleFiles

    Code:
    Option Compare Database
    Option Explicit
    
    Dim fso As Object
    
    'Original code courtesy of Dev Ashish
    '###############################################
    'updated for 64-bit Access by Colin Riddington (Mendip Data Systems) - 06/03/2019
    #If VBA7 Then
        Private Declare PtrSafe Function apiShellExecute Lib "shell32.dll" _
            Alias "ShellExecuteA" _
            (ByVal hWnd As LongPtr, _
            ByVal lpOperation As String, _
            ByVal lpFile As String, _
            ByVal lpParameters As String, _
            ByVal lpDirectory As String, _
            ByVal nShowCmd As Long) _
            As Long
    #Else '32-bit Office
        Private Declare Function apiShellExecute Lib "shell32.dll" _
            Alias "ShellExecuteA" _
            (ByVal hWnd As Long, _
            ByVal lpOperation As String, _
            ByVal lpFile As String, _
            ByVal lpParameters As String, _
            ByVal lpDirectory As String, _
            ByVal nShowCmd As Long) _
            As Long
    #End If
    '###############################################
    
    Public Const WIN_NORMAL = 1         'Open Normal
    Public Const WIN_MAX = 2            'Open Maximized
    Public Const WIN_MIN = 3            'Open Minimized
    
    Private Const ERROR_SUCCESS = 32&
    Private Const ERROR_NO_ASSOC = 31&
    Private Const ERROR_OUT_OF_MEM = 0&
    Private Const ERROR_FILE_NOT_FOUND = 2&
    Private Const ERROR_PATH_NOT_FOUND = 3&
    Private Const ERROR_BAD_FORMAT = 11&
    
    Function fHandleFile(stFile As String, lShowHow As Long)
    
    On Error GoTo Err_Handler
    
    Dim lRet As Long, varTaskID As Variant
    Dim stRet As String
        'First try ShellExecute
        lRet = apiShellExecute(hWndAccessApp, vbNullString, _
                stFile, vbNullString, vbNullString, lShowHow)
                
        If lRet > ERROR_SUCCESS Then
            stRet = vbNullString
            lRet = -1
        Else
            Select Case lRet
                Case ERROR_NO_ASSOC:
                    'Try the OpenWith dialog
                    varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
                            & stFile, WIN_NORMAL)
                    lRet = (varTaskID <> 0)
                Case ERROR_OUT_OF_MEM:
                    stRet = "Error: Out of Memory/Resources. Couldn't Execute!"
                Case ERROR_FILE_NOT_FOUND:
                    stRet = "Error: File not found.  Couldn't Execute!"
                Case ERROR_PATH_NOT_FOUND:
                    stRet = "Error: Path not found. Couldn't Execute!"
                Case ERROR_BAD_FORMAT:
                    stRet = "Error:  Bad File Format. Couldn't Execute!"
                Case Else:
            End Select
        End If
        
        fHandleFile = lRet & _
                    IIf(stRet = "", vbNullString, ", " & stRet)
                    
    Exit_Handler:
        Exit Function
        
    Err_Handler:
        MsgBox "Error " & Err.Number & " in fHandleFile procedure : " & Err.Description, vbOKOnly + vbCritical
        Resume Exit_Handler
    
    End Function
    Now all you need to do is call the application with the path of the file and let Windows do the rest.
    This code can be used to start any registered applications, including another instance of Access.
    If it doesn't know what application to open the file with, it just pops up the standard "Open With.." dialog.
    It can even handle URL's and mailto:

    'Open a PDF:
    ' fHandleFile("C:\MyDocuments\MyPDFDoc.pdf",WIN_NORM AL)

    'Open a folder:
    ' fHandleFile("C:\TEMP",WIN_NORMAL)

    'Call Email app:
    ' fHandleFile("mailto:bpo@yahoo.com",WIN_NORMAL)

    'Open URL:
    ' fHandleFile("http://uk.yahoo.com";, WIN_NORMAL)

    'Handle Unknown extensions:
    ' fHandleFile("C:\TEMP\TestThis",Win_Normal)
    Last edited by isladogs; 12-27-2020 at 10:59 AM.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    garrod is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    6
    Thank you for your reply. Unfortunately I am not a Programmer just a regular Access User with beginner level knowledge of VB. I was therefore lost when you got to "Install the following into a standard module" eg. modHandleFiles
    This is a very simple Watercraft Maintenance Database. There is a Form showing all the Craft. On the Form there is a sub form with Hyperlinks to Documents relating to that particular craft. eg. Maintenance Reports. Manuals, photos, video etc. All I am trying to do is stop the Pop Up Security warning when I click on the Hyperlink. Is there a simple procedure that will stop this?

  8. #8
    garrod is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    6

    Screen Shot

    Please see attached screen shot of the Subform with the Hyperlinks
    Attached Thumbnails Attached Thumbnails Subform.JPG  

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    @Garrod

    If I knew of a way of preventing the warning using a hyperlink, I would have said so. However the other method is very simple.

    To create a new module, click Create on the Ribbon then Module. Then paste in all the code I supplied in my previous reply and save.
    To use the code, add a line like those in the examples I supplied at the end of the code.
    You will no longer use hyperlinks fields in your code.
    The PDF filename and path should now just be a text field.

    Hope that makes sense to you
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,655
    Like Colin, I've used the same fHandleFile procedure for many years. Keep a copy of it somewhere because you'll probably also use it for years to come.

    There are some datatypes in access that are horrible. Hyperlinks are one of them (in my opinion) They are difficult to work with. It is much easier to store the path to a file
    and use fHandleFile.

    Looking at your screenshot, I thought I'd mention the King of crappy datatypes - The attachment field.
    If you are using them for you photograph, dont! Store the path to your photo as plain text and then set the picture property of an image control to that path.
    Attachment fields will bloat your database.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  11. #11
    garrod is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    6
    Many thanks for your reply and patience dealing with my ignorance!
    To create a new module, click Create on the Ribbon then Module. Then paste in all the code I supplied in my previous reply and save. - I have done this, but what name should I give it when I save?
    You will no longer use hyperlinks fields in your code. The PDF filename and path should now just be a text field. I have changed the Hyperlinks fields in the Subform to Plain Text but I am not sure what to do next to open the documents

    To use the code, add a line like those in the examples I supplied at the end of the code. I am not sure what you mean by this? Where do I add the line like the examples you supplied?
    I am not sure what you mean by - "Now all you need to do is call the application with the path of the file and let Windows do the rest. " How do I do this?

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    You can use any name you like for the module EXCEPT it MUST NOT be the same as the procedure name fHandleFile
    I call the module modHandleFile.

    Add code to the Double Click event of the Link field ...or whatever it is now called. Something like this should work:

    Code:
    Private Sub Link__DblClick(Cancel As Integer)
    
       Dim strFile As String 'define a variable for the file name & path
       strFile=Me.File 'set the variable to the file selected 
    
       Call fHandleFile(strFile, WIN_NORMAL) 'open the PDF file in its default file handler 
    
    End Sub
    Now when you double click the file, it will open in the default program associated with PDF files and there is no warning message

    Whilst that should work fine, personally I would use a 2 column listbox instead of your subform.
    If you want to try that, use similar code but in the listbox AfterUpdate event
    Assuming the link field is the 2nd column of the listbox - referred to as Column(1) as numbering starts at 0 - then

    Code:
    Private Sub ListBoxName__AfterUpdate()
    
       Dim strFile As String 'define a variable for the file name & path
       strFile=Me.ListBoxName.Column(1) 'set the variable to the file selected 
    
       Call fHandleFile(strFile, WIN_NORMAL) 'open the PDF file in its default file handler 
    
    End Sub
    Hopefully you are able to do that yourself now

    EDIT:
    Forgot to say, strictly speaking you don't need to 'Call' the fHandleFile function. If you want to omit it, also omit the brackets on that line so it becomes: fHandleFile strFile, WIN_NORMAL
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #13
    garrod is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2020
    Posts
    6
    Many, many thanks its all working great! Thank you again for your patience particularly with someone born in the 1950's and had never touched a computer until I was in my 40's!

  14. #14
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    You're welcome. Its never too late to learn....btw we're around the same age -I was born in 1952
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  15. #15
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    1953 for me..

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

Similar Threads

  1. Turn of security warning in Access
    By jaryszek in forum Access
    Replies: 5
    Last Post: 07-30-2018, 03:13 PM
  2. Replies: 4
    Last Post: 08-14-2017, 11:52 AM
  3. Replies: 4
    Last Post: 05-19-2015, 09:04 AM
  4. Pop-up Concern
    By ccchan in forum Forms
    Replies: 1
    Last Post: 03-12-2014, 10:47 PM
  5. Replies: 1
    Last Post: 02-27-2011, 06:50 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