Checking if CurrentDB is in a trusted location (1 Viewer)

KitaYama

Well-known member
Local time
Today, 18:26
Joined
Jan 6, 2022
Messages
1,541
I'm trying to close a database if it's opened from a location outside of trusted locations.

2023-08-12_15-52-50.png


Above autoexec closes the database, but prior to this, I receive the following error message.

2023-08-12_16-04-23.png


My question:
Is there any possible way to hide this message I receive?
I prefer to close the database silently. (without an error message)

If Access keeps giving me warning, what's the point of being able to check if the location is trusted or not?

Thanks.
 
Last edited:

ebs17

Well-known member
Local time
Today, 11:26
Joined
Feb 7, 2020
Messages
1,946
It doesn't make sense that a file with potentially dangerous code could break itself out of a security block. So I don't think you'll be offered opportunities to do that.

The path is different: the person responsible knows that the new application is clean and secure and registers it in the Trust Center before the application itself is called up.

If it is permitted in your environment, you can look at the corresponding entries in the registry, create new ones and delete them.
 

isladogs

MVP / VIP
Local time
Today, 10:26
Joined
Jan 14, 2017
Messages
18,224
When an app is run from a non-trusted location, autoexec macros will run 'safe' actions such as checking whether the location is trusted. However actions deemed 'unsafe' will not run. That includes closing the database automatically

See my article for further explanation

It also includes an example app to illustrate this exact point
 

KitaYama

Well-known member
Local time
Today, 18:26
Joined
Jan 6, 2022
Messages
1,541
It doesn't make sense that a file with potentially dangerous code could break itself out of a security block. So I don't think you'll be offered opportunities to do that.

The path is different: the person responsible knows that the new application is clean and secure and registers it in the Trust Center before the application itself is called up.

If it is permitted in your environment, you can look at the corresponding entries in the registry, create new ones and delete them.
I’m sorry but I can’t understand what you’re trying to tell me.
Potentially dangerous code? What does it mean? Nothing’s dangerous. It’s a database we use it daily. I just want to prevent someone open it outside of trusted location.

is it that horrible?
 

KitaYama

Well-known member
Local time
Today, 18:26
Joined
Jan 6, 2022
Messages
1,541
When an app is run from a non-trusted location, autoexec macros will run 'safe' actions such as checking whether the location is trusted. However actions deemed 'unsafe' will not run. That includes closing the database automatically

See my article for further explanation

It also includes an example app to illustrate this exact point
Thanks. was sure you have something on this. I’ll see if I can find the answer to my question.
 

ebs17

Well-known member
Local time
Today, 11:26
Joined
Feb 7, 2020
Messages
1,946
Potentially dangerous code? What does it mean?
With VBA you can access the computer's file system and delete, change and add there. You have access to the Win-API's and can do everything imaginable. If that isn't a potential danger!

You have to trust the developer not to use such dangerous things or only use them for a good cause.
Trust in the developer is implemented through entries in the Trust Center and through certificates.

Macros cannot perform dangerous virus-like actions. So if you only implement your program control with macros alone, you have no external security problem, which is a pro for macros.
However, macros also have many shortcomings. Restricted to this, you can only implement the very simplest of tasks.
 
Last edited:

Users who are viewing this thread

Top Bottom