VBA code to add trusted location in Microsoft Access 2010

Does someone have VBA code that will add a trusted location in Microsoft Access 2010?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shahid ThaikaSole ProprietorCommented:
Unfortunately, you cannot do that by code, and that's the answer. Think of it this was, Excel does not trust VBA coding, and you are trying to have it trust through VBA coding... will not work. You have to manually Trust VBA using Excel options.
twarrenbAuthor Commented:
The question was poorly worded.  What I'm looking for is VB code that can be run in Microsoft Access 2010 that will designate a specified folder as being a trusted location.
Shahid ThaikaSole ProprietorCommented:
I am not sure if Access VBA has in-built commands to add trusted location, but you could try adding it by making appropriate registry entries. If you don't know how to edit the registry using VB, there are many tutorials out there.

All trusted locations are stored in the registry at:
HKEY_CURRENT_USER/Software/Microsoft/Office/14.0/application_name/Security/Trusted Locations

Where "application_name" can be Microsoft Access, Microsoft Excel, etc. Trusted locations are stored in registry entries named Path as String (REG_SZ) value types. With a little bit of discovery, you should be able to add trusted locations through your app.

See the following article for more info...
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

twarrenbAuthor Commented:
I know that Access VBA has no built-in command and that trusted locations are stored as you describe.  However, I was looking for code that would add trusted locations to the registry.  Thanks for your help/
Shahid ThaikaSole ProprietorCommented:
Here is a good resource to go through on accessing the registry in VB6... should be the same for VBA

Note, many tutorials out there will use something like GetSettings and SaveSettings. This is a limited (and safe) form of accessing the registry in VB, but you need to go through a tutorial such as the above to read/write any value, anywhere in the registry.

Also, do note that the String value type for storing Trusted Locations is different in Office 2010 as opposed to ones in the past. Do take the time to go through the entire article on my previous link reference.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
twarrenbAuthor Commented:
While the expert didn't cite actual code, he or she directed me to tutorials where I can teach myself.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.