VBA for enable contents

mounty76

Registered User.
Local time
Today, 03:41
Joined
Sep 14, 2017
Messages
341
Hello!!

I have a DB that is on a server, when it opens I have to click on enable content every time, I've looked in the trust center settings and none of the changes in here makes a difference.

I have an AutoExec file that runs but obviously I get an error as I need to enable content.

Is there anyway to by pass 'enable content' with VBA or any simple suggestions/examples for error handling on this? Every thing I've seen on error handling seems quite complicated!

Thanks in advance!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:41
Joined
Aug 30, 2003
Messages
36,125
In the trust center you should be able to add the db's location in Trusted Locations.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:41
Joined
Feb 19, 2013
Messages
16,607
if your db is on a server you need to tick the 'allow trusted location on my network' option before selecting the folder where your db is located
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:41
Joined
Oct 29, 2018
Messages
21,467
Is there anyway to by pass 'enable content' with VBA
Unfortunately, that's a catch-22. You can't execute something that hasn't been trusted yet, so any code to trust itself won't run at all.
or any simple suggestions/examples for error handling on this?
The Autoexec macro should still run whether the app is trusted or not. So, you should be able to use If CurrentProject.IsTrusted as a check or error handler when the app starts.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:41
Joined
Oct 29, 2018
Messages
21,467
i don't think it will.
As far as I know it does, but I guess someone else could let us know. I think that's the reason why there is a CurrentProject.IsTrusted If condition available.
 

mounty76

Registered User.
Local time
Today, 03:41
Joined
Sep 14, 2017
Messages
341
Hi All, Thanks for this, it wouldn't allow me to add a folder as a trusted location, it just says it cannot add it as a trusted location for security reasons. I changed the ActiveXsetting to enable all controls and in Macro Settings I enabled all macros. This has worked but obviously not ideal?
 

GPGeorge

Grover Park George
Local time
Today, 03:41
Joined
Nov 25, 2004
Messages
1,855
Hi All, Thanks for this, it wouldn't allow me to add a folder as a trusted location, it just says it cannot add it as a trusted location for security reasons. I changed the ActiveXsetting to enable all controls and in Macro Settings I enabled all macros. This has worked but obviously not ideal?
Some folders are not supposed to be accessible to users; i.e. those in which protected system files are located. Note response #3 regarding network locations as well.
 

Users who are viewing this thread

Top Bottom