Home All Groups Group Topic Archive Search About

Check if VBA Code is Disabled

Author
28 Nov 2008 4:01 PM
Cory
Running Access 2007 on Vista.

I have a database that I'm trying to give some bare bones security to that I
need some help with. I have a table of usernames and passwords and a form for
the users to enter their username and password into. I have the form opened
when the database is opened via the Autoexec macro. The issue is, if the
database gets moved or copied to somewhere that isn't a trusted location,
then the code behind the form won't run and someone could just close the form
and get into the database.

My question is this, is there a way in the Autoexec macro to check if the
VBA code is enabled or if the database is in a trusted locaton? If everything
was normal, the macro could proceed and open the form, otherwise it would
close the database. If this is possible, then the question of what to do if
the Autoexec macro gets disabled... Any suggestions would be greatly
appreciated.

Thanks in advance for any help that you can provide.

  -Cory

Author
30 Nov 2008 3:08 AM
Tom van Stiphout
On Fri, 28 Nov 2008 08:01:04 -0800, Cory
<C***@discussions.microsoft.com> wrote:

CurrentProject.IsTrusted

The Northwind sample database uses this.

-Tom.
Microsoft Access MVP


Show quoteHide quote
>Running Access 2007 on Vista.
>
>I have a database that I'm trying to give some bare bones security to that I
>need some help with. I have a table of usernames and passwords and a form for
>the users to enter their username and password into. I have the form opened
>when the database is opened via the Autoexec macro. The issue is, if the
>database gets moved or copied to somewhere that isn't a trusted location,
>then the code behind the form won't run and someone could just close the form
>and get into the database.
>
>My question is this, is there a way in the Autoexec macro to check if the
>VBA code is enabled or if the database is in a trusted locaton? If everything
>was normal, the macro could proceed and open the form, otherwise it would
>close the database. If this is possible, then the question of what to do if
>the Autoexec macro gets disabled... Any suggestions would be greatly
>appreciated.
>
>Thanks in advance for any help that you can provide.
>
>  -Cory