table protection with password (1 Viewer)

georgevolos

New member
Local time
Today, 12:05
Joined
Mar 15, 2023
Messages
3
Hello people

I want to make a table only to read ( protecting it with password ) .:confused: Can i make it with vba code ?
Any suggestions ; solutions
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:05
Joined
Sep 21, 2011
Messages
14,301
Excel linked table where the file is read only?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:05
Joined
Feb 19, 2013
Messages
16,612
Short answer is no

Users should not have direct access to the tables, all interactions should be through forms - which you can set to be read only and include an option to allow updates.

If it is permanently read only they you can open as a snapshot either through a form or the underlying query.

There are things you can do to hide the navigation window so users cannot see tables and queries

Other than that you need to be clearer about the actual requirement. I normally recommend you write up a security policy for what you want to protect, from whom and from doing what rather than a piecemeal approach
 

Josef P.

Well-known member
Local time
Today, 11:05
Joined
Feb 2, 2023
Messages
826
Does it have to be secure, or is it enough to prevent it from being changed by mistake?
 

Attachments

  • ReadOnlyTable.zip
    20.7 KB · Views: 85

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:05
Joined
Feb 28, 2001
Messages
27,186
Hello people

I want to make a table only to read ( protecting it with password ) .:confused: Can i make it with vba code ?
Any suggestions ; solutions

Theoretically possible but with VERY bad side effects. You can link to the table in its own back-end file and protect that file with a password. That table CANNOT participate in relationships with any other tables outside of its host file. In essence, you isolate the table if this level of protection is what you wanted. Remember, that isolation kills many useful abilities that Access might otherwise use. So the answer is YES but not recommended.
 

isladogs

MVP / VIP
Local time
Today, 10:05
Joined
Jan 14, 2017
Messages
18,224
@Josef P.
Although you didn't say so, the read only table in your demo is saved as a system table.
Although the table itself cannot be edited directly, it can be altered using the query you so helpfully provided

Using a different approach, I have created my own demo with a standard (non-system) table which contains one field and one record.
It also contains a query & form.
The table cannot be edited directly or from either of the other 2 objects.
Records cannot be added or deleted, nor can the table be deleted.

My thanks to @GPGeorge for the idea behind this demo

@georgevolos
I agree with the comments in previous posts. Tables are made 'secure' by ensuring users have no access to them
However, you might find the attached demo of interest
 

Attachments

  • ReadOnlyTableCR.zip
    23.2 KB · Views: 82

Josef P.

Well-known member
Local time
Today, 11:05
Joined
Feb 2, 2023
Messages
826
@Josef P.
Although you didn't say so, the read only table in your demo is saved as a system table.
It is a system table, so that the (old) mdw protection works.
Without mdw protection, a system table would also be editable when using a query with it.
With the right mdw file, the data in the table are editable.
 
Last edited:

ebs17

Well-known member
Local time
Today, 11:05
Joined
Feb 7, 2020
Messages
1,946
@isladogs: Possibly the table should contain more than a single "X". Then the used check constraint would have to be significantly more comprehensive to the point that it cannot be comprehensively created at all.

A complementary idea: A disconnected recordset can be used in a table-like manner and can be set to ReadOnly.
Where it gets its data from would be another question and to be derived from other conditions.

Already with a link to a text file records are not deletable or editable, but one could add new ones. If one hides such a text file in the widths of the filesystem, if necessary only with necessary access from an encryption, another access to it becomes extremely difficult. One very rarely finds what one is not looking for.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:05
Joined
May 7, 2009
Messages
19,243
I want to make a table only to read ( protecting it with password )
a simple (but easy to figure out) is use Datamacro (Before Change event) of the table.
just call RaiseError on the macro.
 

Josef P.

Well-known member
Local time
Today, 11:05
Joined
Feb 2, 2023
Messages
826
a simple (but easy to figure out) is use Datamacro (Before Change event) of the table.
just call RaiseError on the macro.
This could then also be used to include a password query.
Enter password in an extra table, change data in the tables, delete password again. Check the password in the trigger and trigger an error as soon as it does not match.
 

isladogs

MVP / VIP
Local time
Today, 10:05
Joined
Jan 14, 2017
Messages
18,224
It is a system table, so that the (old) mdw protection works.
Without mdw protection, a system table would also be editable when using a query with it.
With the right mdw file, the data in the table are editable.
To clarify, user created system tables become editable in queries.
However, built in system tables like MSysObjects are still read only if opened as a query

Possibly the table should contain more than a single "X". Then the used check constraint would have to be significantly more comprehensive to the point that it cannot be comprehensively created at all.

A complementary idea: A disconnected recordset can be used in a table-like manner and can be set to ReadOnly.
Where it gets its data from would be another question and to be derived from other conditions.

Already with a link to a text file records are not deletable or editable, but one could add new ones. If one hides such a text file in the widths of the filesystem, if necessary only with necessary access from an encryption, another access to it becomes extremely difficult. One very rarely finds what one is not looking for.
Sorry. I don't understand the first comment.
Although the example given was as simple as it could be, the table can have more fields and records and still be constrained to be read only
I just used an example that I had to hand.

Yes, disconnected ADO recordsets can be used for this.

Sorry but Google translate also makes your third point difficult to understand
 

Users who are viewing this thread

Top Bottom