Security Warning
By Richard Rost
33 days ago
Fix Security Warning When Using FollowHyperlink
In this video, I will show you how to work around the security warning in Microsoft Access when trying to open images or files stored on network drives, Google Drive, OneDrive, or similar locations using the FollowHyperlink method. You'll see why Access shows these warnings, how file sources affect them, and learn a simple way to use the Shell command in VBA to open files without triggering the security warning, allowing you to view files from different locations safely and efficiently.
Sabrina from Akron, Ohio (a Gold Member) asks: I'm using FollowHyperlink to open JPG files from my Access database like you showed in your video. It works fine when the images are in the same folder as my database, but when I try to open images from my Google Drive mapped letter, I get a security warning every time. The folder is already in my Trusted Locations. Is there a way to stop this warning, or is FollowHyperlink just broken with Google Drive?
Members
There is no extended cut, but here is the file download:
Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!
Prerequisites
Links
Recommended Courses
Keywords
TechHelp Access, FollowHyperlink security warning, open images from network drive, Google Drive images, OneDrive images, trusted folder location, VBA Shell command, bypass Access security warning, open JPEG file VBA, file source Windows security, open PDF VBA, network share drive images, default app with Shell VBA, prevent unsafe location warning
Intro
In this video, I will show you how to work around the security warning in Microsoft Access when trying to open images or files stored on network drives, Google Drive, OneDrive, or similar locations using the FollowHyperlink method. You'll see why Access shows these warnings, how file sources affect them, and learn a simple way to use the Shell command in VBA to open files without triggering the security warning, allowing you to view files from different locations safely and efficiently.
Transcript
Welcome to another TechHelp video brought to you by AccessLearningZone.com. I'm your instructor, Richard Rost. Today, we're going to talk about how to get rid of that annoying security warning when you try to open images if they're on a network share drive, Google Drive, OneDrive, or something like that.
It works fine if it is on a local drive, but if you try to follow hyperlinks sometimes, those files that are on network drives give you issues, especially for me all the time with my Google Drive folder. So we're going to see how to get Access to stop treating images like they have viruses in them.
Today's question comes from Sabrina in Akron, Ohio, one of my Gold members. She says, I'm using FollowHyperlink to open JPEG files from my Access database like you showed in your video. It works fine when the images are in the same folder as my database. But when I try to open images from my Google Drive mapped letter, I get a security warning every time. The folder is already in my trusted locations. Is there a way to stop this warning, or is FollowHyperlink just broken with Google Drive?
Well, yes, it's kind of broken with Google Drive. It's a Windows security issue, and even if you put that Google Drive in your trusted folder location, it does not always work. Let's see an example and I'll show you how to fix it.
First off, for everyone else, if you haven't watched my FollowHyperlink video, go watch this. It shows you how to open up pretty much any file type from right inside your Access database using the FollowHyperlink command.
And if you do not know what trusted locations and trusted folders are, go watch this video. Basically, you are telling Access, whatever I put in this folder is safe, but it does not always work with network locations.
Now, this is a developer-level video, but just like FollowHyperlink, we can fix this with one line of code. I'm going to show you that line of code and exactly where to put it. But if you have never done any VBA programming before, go watch this video first. It's about 20 minutes long and teaches you everything you need to know to get started.
Let's take a look at the example.
Here I am in my TechHelp free template. This is a free database. You can grab a copy off my website if you want to. Now, I do not have an image field in here, but let's just go ahead and cheat and we'll say that country is our image field. So it's got the path and file name of our picture in there that we want to display.
I'll just copy a button, copy and paste, and I'm going to slide it down here and we'll just change this to View. All we're going to do in this View button build event is we're going to say FollowHyperlink country, again pretending country is the field that's got our picture in it.
I'll come back into here and I'll put in here the path and file name of an image that I want to view. Now I happen to have put one in my database folder, which is C:\\database\\Richard.jpeg. Guess what that happens to be? Let me hit View.
Then this strapping young fellow appears, and I say young because this is about a 10-year-old picture. That works just fine from the database folder.
Now, I also put a copy of this on my server, which is my Z drive, so Z:\\, and that's one of my trusted folder locations. I'll hit View now and there it is again. That works fine.
Now I also put it in my Google Drive folder, which for me happens to be G:\\My Drive\\Richard, and it works fine for me. I'll explain why in just a minute. But there is another file in there that I have called snap.jpeg, S N A P. This is a screenshot that was created by my screenshot software just a moment ago. When I try to hit View now, boom, there you go.
The difference is because the Richard.jpeg, I actually copied into there myself, and so Windows sees it as something that I copied into Google Drive. But the snap.jpeg was created by my screen capture software. Windows does not know what that is; it could have come from somebody else, so it throws up the security warning.
So it really all depends on the location of the file and the source of the file - where did it come from? Is it something that Windows knows you copied there yourself, or is it something that was just kind of there or just kind of appeared? Maybe some other program created it. Even though it's an image, Windows is still being overly safe.
So how do we get around that? The key is to not use FollowHyperlink. The key is to use the Shell command. We'll just tell Windows, "I want you to open this file. I do not care what it is. Just open it."
Here is that command. I'm just going to paste it over this one. I've got it in my clipboard right now. There it is. I'm going to explain what all this is in just a minute, but we're replacing FollowHyperlink with the Shell command.
Let's give it a Debug Compile once in a while and let's come back over here. Let's hit the button, and there we go. Now it opens. That's what's in my snap.jpeg file.
So let's talk about what this exactly does. This is the command that we just put in VBA.
Shell is a VBA function that tells Windows to run a command, the same way as if you type it in the command prompt or you use the run dialog. Everything inside the outermost quotes is the command that Windows executes. I made those red, so this guy and this guy, that's the command string itself.
CMD is the Windows command processor. Think of that like opening a command prompt behind the scenes. The /C says run the command that follows and then exit immediately. If you don't have the /C, the command window would stay open. It is basically like "do this and then exit."
Now, Start is essentially a Windows command that says, "I want you to open up this file using whatever the default associated application is." So if it's a Word document, open it in Word. If it's an Excel spreadsheet, open it in Excel. Whatever the extension is, is what it looks at. JPEG will open in your default image viewer. PDF will open in your default PDF application or whatever that happens to be.
So yes, that works. That's what Start does.
Start takes two parameters. The first parameter is actually the window title, whatever you want to see at the top in the title bar. The second parameter is the file. If we don't care about the window title, we basically put a set of empty quotes here. But since this is inside of a string, for every quote in here, we have to use double double quotes. So that's the opening double double quotes and that's the closing double double quotes. This basically is a set of empty quotes because we do not care what the window title is.
I'll color the other one, so that's just an empty string.
Now, image path - that's the name of the JPEG file. That also has to go inside of double quotes. So this right here is the double quotes; let's make that green. That's the double quotes. It starts this and then this is the other set of double quotes like that. These guys here are just opening and closing the string, just like the opening ones work. Just like that. Same thing.
I'm color coding everything because everyone always has trouble, myself included, with these double quotes.
Here, this is one string that includes double quotes inside of there, and then this is another string. But image path is inside of quotes and that's an empty parameter. I know it's confusing. I'm trying to get it all to fit nicely on one line.
So see what that is? CMD /C - open the command interpreter. Start means "I want you to run whatever application you have to, to open this file." Here is the file inside of double quotes. VB-HIDE just means I do not need to see the command window open, so just keep it hidden in the background. That's a VBA command that says "open this up," but I do not need to see it. I just want to see the final result because the Start will run that application.
This will work because it never touches Access's hyperlink logic. There are no security checks, no unsafe location warning, and no Trust Center stuff. It just runs it. It just hands the file to Windows and says, "Windows, you do what you have to do to open this program or this file."
Think of it like this: If you use FollowHyperlink, you're basically saying to Access, "Hey, Access, click this link for me," and Access says, "Ooh, links might be dangerous. Are you sure?" if it does not know for sure if it's a safe file. Whereas the Shell command just says, "Yo, Windows, open this file for me." Windows goes, "okay, no problem," and it just knows what to do with a JPEG, for example.
That also means you can now very easily open up other types of files, like word.docx, and hit Do, and here comes Microsoft Word. There you go. Any type of file that Windows knows how to open, you can use.
So there you go. That's it. That's your TechHelp video for today. I hope you learned something. Live long and prosper, my friends. I'll see you next time.
Quiz
Q1. What is the primary issue discussed in this video? A. Security warning when opening images on local drives B. Security warning when opening images from network or cloud drives using Access C. Importing images into Access using VBA D. Synchronizing files between Google Drive and Access
Q2. What VBA command is initially used to open files in the video? A. Shell B. OpenFile C. FollowHyperlink D. AccessLink
Q3. Why does the security warning sometimes appear even if the folder is in Trusted Locations? A. The file type is unsupported by Access B. Windows security checks the file's source, not just its location C. Google Drive does not sync correctly D. Access ignores Trusted Locations
Q4. What makes Windows treat files as potentially unsafe? A. Files are over 10 MB in size B. Files are opened directly from Access C. Files were created by an unknown program or copied from another source D. Files have a .jpeg extension
Q5. What is the recommended solution to avoid the security warning? A. Reinstall Access B. Move all files to the local drive C. Use the Shell command instead of FollowHyperlink D. Change the file extension
Q6. In the context of the Shell command provided, what does 'CMD /C' do? A. Opens a file directly using its associated program B. Runs a command and keeps the command prompt open C. Runs the command and exits immediately D. Applies a hidden attribute to the file
Q7. What does the 'Start' command do in the Shell command string? A. Installs the needed software for the file B. Runs a security scan before opening the file C. Opens the file with its default associated application D. Deletes the temporary file after execution
Q8. Why are there double double quotes ("") inside the Shell command string? A. To insert a space in the file name B. To escape quotes within a VBA string C. To close the command prompt automatically D. To separate parameters in the path
Q9. Which benefit is NOT mentioned as a result of switching from FollowHyperlink to the Shell command? A. No Trust Center security warning is shown B. Any file type Windows can open is supported C. Access runs a virus scan before opening the file D. The process uses the default associated application
Q10. What does vbHide do in the Shell command? A. Opens the file in full screen B. Hides the command window during execution C. Prevents the file from opening D. Displays a custom message
Answers: 1-B; 2-C; 3-B; 4-C; 5-C; 6-C; 7-C; 8-B; 9-C; 10-B
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary
Today's video from Access Learning Zone focuses on how to eliminate that persistent security warning that appears when you attempt to open images stored on network drives, Google Drive, OneDrive, or similar locations using Microsoft Access. Many users find that opening images from a local drive with Access works seamlessly, but when those images reside on a mapped network drive or a cloud storage folder, annoying security prompts can interrupt the process. This is especially common when using Google Drive, as I often see the issue myself.
One of my students, Sabrina, wrote in asking about this exact scenario. She explained that she uses the FollowHyperlink command to open JPEG files from her Access database, and everything functions properly as long as the images are stored in the same folder as the database. However, when she moves her images to a Google Drive location that's mapped to a drive letter, Access throws up a security warning every time she tries to open an image, even though her Google Drive folder is already marked as trusted. Sabrina wondered whether there was a way to suppress that warning, or if FollowHyperlink just does not play nicely with Google Drive.
This is not a unique situation. FollowHyperlink is unreliable in these cases because Windows applies additional security restrictions when files originate from network or cloud locations. Even defining a trusted folder often does not resolve the problem. This is why understanding the distinction between local and network-trusted folders is important, particularly when working with Access. If you are not already familiar with how trusted locations work in Access, I recommend learning about them first so you understand their limitations in these scenarios.
Now, for those of you who may have never worked with VBA before, I suggest you familiarize yourself with the basics of VBA programming in Access. There are plenty of resources available, including a video on my website, which will help you get started from scratch.
To illustrate the problem and solution, I worked with my TechHelp free template – a sample database you can download from my site if you like. Although that template did not originally have a field specifically for image paths, I repurposed the Country field just for this demonstration by populating it with the path and filename of the image I want to view.
I created a button called View, so when you click it, the FollowHyperlink function attempts to open the image whose path is stored in that field. If the image file is located in the same folder as the database, Access will open it with no complaint. The same holds true for images on my network server's Z drive, which I have already marked as a trusted location.
However, things get unpredictable with Google Drive. When I store a file in G:\\My Drive\\ (my mapped Google Drive folder), sometimes Access opens it without an issue. This mainly happens if I placed or copied the file there directly. But if the file was created by another application, such as my screenshot tool, Windows can perceive it as a possible security risk and throw up the warning prompt.
So, even when the folder is trusted and the file type is harmless (such as JPEG), Access and Windows are still highly protective, especially when the file origin is unclear. The core issue is not in Access itself, but in Windows' security model.
The workaround is to avoid using FollowHyperlink for opening these files. Instead, we turn to the Shell command in VBA, which simply instructs Windows to open the file with whatever application is associated with that file type. Using Shell, we can bypass Access' security checks and let Windows handle the file, opening it in the correct default program.
When you use the Shell command, you're essentially giving Windows the exact instructions to open the file. The command launches the Windows Command Processor (CMD), uses the Start command to open the file, and includes parameters to ensure the CMD window remains hidden. The trickiest part of assembling this Shell command is handling the quotation marks correctly, because you are embedding quotes within quotes inside your VBA code. If you are not used to this, it can be confusing, so color coding or carefully breaking down the individual string components may help you visualize how it all fits together.
With this Shell approach, Access no longer gets involved in verifying the link or checking for trusted locations. It simply tells Windows to open the file, and Windows does so using the default application associated with the file extension. This means you can open not just images, but any type of file – as long as Windows knows how to open it.
So, if you find yourself consistently battling security warnings when using FollowHyperlink in Access with images or other files on network or cloud drives, switch your approach to Shell. This method is more reliable and does not trigger those security prompts.
For a complete video tutorial with step-by-step instructions on everything discussed here, visit my website at the link below. Live long and prosper, my friends.
Topic List
Explaining why FollowHyperlink triggers security warnings Demonstrating image opening issues on network and cloud drives Showing use of trusted locations in Access Explaining why trusted folders may not solve the warning Walkthrough of using FollowHyperlink in a form button Diagnosing why some files trigger warnings and others do not Explaining Windows file security based on file origin Replacing FollowHyperlink with the VBA Shell command Detailed breakdown of the Shell command syntax in VBA Using the Windows cmd.exe and start command to open files Proper handling of double quotes inside Shell commands Using Shell with vbHide to prevent command window pop-up Opening images and other file types with Shell in Access Bypassing Access Trust Center warnings using Shell
Article
If you have ever tried to open image files stored on network locations or cloud drives like Google Drive, OneDrive, or a shared network folder from your Microsoft Access database, you might have run into a frustrating security warning. Normally, when you use the FollowHyperlink method in Access to open an image, document, or any other file, it works fine when the file is on your local computer. But as soon as you try it with files on a mapped network drive or a sync folder like Google Drive, Windows or Access raises a security alert, even if you have already marked that location as trusted in your Access Trust Center settings.
To better understand this problem, let us look at a common scenario. Imagine you have a table in Access that stores file paths—perhaps image file locations. Your Access form has a button that runs code like this:
FollowHyperlink Me.ImagePath
Here, ImagePath could be something like C:\\database\\Richard.jpeg. Hitting the button opens the file instantly with no fuss. You get the same smooth experience with a server location like Z:\\Data\\Richard.jpeg, as long as that folder is in your trusted locations list. But let us say your files are on a Google Drive folder mapped as G:\\My Drive\\Richard.jpeg. In some cases, this works. In others, especially for files created by other software or synced from elsewhere, you are stopped by a security warning, even if that folder is marked as trusted.
The reason for this inconsistency is that Windows keeps track of where a file originated. If you copied a file into your cloud folder yourself, Windows recognizes it as safe. But if it was created by another program (such as a screenshot tool) or downloaded from the Internet, Windows might not trust it, and Access will prompt a warning every time you try to open it with FollowHyperlink.
How do you get around this? You might think fiddling with more trust settings in Access or Windows will help, but even marking the folder as trusted does not always solve the problem for networked or cloud-synced files.
The easiest and most reliable solution is to stop using FollowHyperlink and instead use the Shell command to open the file. The Shell command lets you tell Windows directly to open a file with its associated program, bypassing Access's internal security checks and trusted location requirements. This simple change not only gets rid of the annoying warning but also lets you open any type of file that Windows knows how to handle, whether it is an image, Word document, PDF, or anything else.
Here is the VBA code you need for this method:
Shell "cmd /c start """" """ & Me.ImagePath & """", vbHide
Let me break down how this code works. The Shell function runs a command in Windows, just as if you typed it in the Run dialog. The first argument to Shell is the command string. In this example, "cmd /c start """" """ & Me.ImagePath & """" tells Windows to open a command prompt, run the start command, and open the file named in Me.ImagePath. The /c switch tells the command processor to execute the given command and then terminate. The start command opens the specified file with whatever application is associated with that file extension—JPEGs open in your default photo viewer, DOCX files in Word, and so on.
Notice the four double quotes: start "" is required because start's first parameter is a window title. If you do not care about specifying a title, you just provide two sets of empty double quotes. Because you are building a string in VBA, you need to escape them—that is, use two double quotes together inside the string for each actual double quote in the command.
Finally, vbHide is an optional argument telling Windows to keep the command prompt window hidden. You do not need to see the black box pop up—you just want your file to open.
To use this in your own form, simply replace your FollowHyperlink line with the Shell command above, making sure to reference the field or variable where your file path is stored (in the example, Me.ImagePath).
Once you make this change, you will see that files open directly with no more security warnings, regardless of whether they are on your computer, a network share, or a cloud-synced directory like Google Drive. This method is extremely flexible and reliable as long as the path in your field or variable points to a real file that Windows can access and has a program registered to open.
In summary, if you are getting security warnings when trying to open files from mapped drives or cloud folders via Access, switch from FollowHyperlink to the Shell command. This change bypasses Access's hyperlink security layer, hands control off to Windows, and ensures your files open smoothly no matter where they are stored. This approach works for any file type associated with an application on your PC, making it a handy tool for Access developers and users alike.
|