Protect database (1 Viewer)

MvP14

Registered User.
Local time
Today, 10:23
Joined
Apr 15, 2003
Messages
66
I have what I assume to be a newbie question: I'm creating a database that will soon be used by some others.

In order to prevent unwanted changes in the structure of the database, I open up homeform with the following code upon opening the database:


Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo


However, I've noticed that users who do not accept active content of the database when opening it for the first time, simply have access to all tables, queries, ...

Is there a way to oblige users to accept active content before the database opens, shutting down the database if they do not accept it?

Or should I use a different way to prevent access beyond the forms I have created?

Any help will be appreciated. Thanks in advance!
 

boblarson

Smeghead
Local time
Today, 00:23
Joined
Jan 12, 2001
Messages
32,059
Create a new database from the Northwind database. Then open it and see how it has a form to tell you to enable it. Then go to the macro AUTOEXEC and copy that macro into your database replacing the forms with what you have. Change the Startup form opening actions to include dialog instead of normal window.


EDIT: Well, that won't quite work. If the form is set to dialog you can't click the options button. So, maybe you can call the macro to close the database instead of opening the notification form.
 
Last edited:

MvP14

Registered User.
Local time
Today, 10:23
Joined
Apr 15, 2003
Messages
66
I'm not sure I get your edit. If I call the macro to close the database instead of opening the notification form, then how can I get the database to be trusted, if it is not trusted yet?
 

MvP14

Registered User.
Local time
Today, 10:23
Joined
Apr 15, 2003
Messages
66
I ended up going with

Code:
If Not [CurrentProject].[IsTrusted] Then 
'first 
Msgbox 
'(indicating that the database should first be trusted and how this can be done)
'next 
Close database. 
If [CurrentProject].[IsTrusted] then OpenForm.

It is essentially what was suggested, but it's not ideal.

It'd be easier if a message box obliging to either trust the database or not could appear. After trusting, db opens, on cancelling or refusing, db closes.

According to what I've found upon further searches, this isn't possible, though.

Thanks for leading the way BobLarson
 
Last edited:

rbh1090

Registered User.
Local time
Today, 17:23
Joined
Aug 5, 2015
Messages
18
Anyone with basic knowledge of MS Access can modify the behavior of a database by removing or altering any of its components: tables, queries, forms, reports, macros, or modules. The easiest and most secure way to prevent this from happening is to save the application as an .accde database; this type of files prevents any modification to its components, and can only be executed.

In a client - server model the only drawback of this format is that when an automatic update of the application is required, the original .accdb file must be modified, convert it back to the format .accde, put it in a shared folder and resorting to an external component that replaces the application with the new version.

There is another alternative to protect the client application and allow the database administrator to update the application without having to resort to an external component that replaces the application file.

Continue here: http://www.msaccessdeveloper.pro/#!Securing-the-frontend/c6x8v/55b047890cf22effe2e365f8
 

Users who are viewing this thread

Top Bottom