I have an Access database and I want to make it read-only
Is there a way to make it read-only with the inability to view the read-only attribute?
Best Regard
I have an Access database and I want to make it read-only
Is there a way to make it read-only with the inability to view the read-only attribute?
Best Regard
You can open a db with a command line switch so that it is read only, but I suspect that is insufficient for you.
You can also right click on the file and set the read only property. Setting folder permissions won't work because users need to create and delete lccdb files, otherwise you will have issues.
I know of no other way and IIRC, you cannot relink tables in a RO database, so there might be other things you cannot do. You probably should take another approach, such as opening forms with snapshot recordsets or locking or disabling all controls.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
What I mean? I want code that selects read-only from the properties of a file and then hides or deactivates the checkbox so that the user cannot return it
Clarification
I have code to control the properties of a database file to make it read-only, hidden or otherwise
What I want?Code:Dim MyPath As String MyPath = CurrentProject.Path & "\MyDB.accdb" SetAttr (MyPath), vbReadOnly
Hide or deactivate a read-only attribute from the database file properties (I don't want the user to change the read-only check box)
Last edited by mr steev; 08-17-2019 at 01:56 AM.
Seems you already have code that works for setting the property and I'm guessing you have a checkbox somewhere that allows the property to be altered. Notwithstanding the fact that if altered, the db has to be restarted for the change to take effect, hide the checkbox from the "normal" user but not yourself. For that you need a table of users so that you can control their access to things by way of their profile or user level permissions stored in that table.
Sorry...
No
I want the vba code to prevent changing the file attribute in Windows when I right-click on the file and choose Properties ..
Then, the user cannot change a readonly attribute that is either inactive or locked and cannot be changed
I don't see the point of what you're asking. Even if you can alter the property in code there's nothing to stop anyone from altering it in Windows. Trying to control read only in this manner is pointless. I can only reiterate what I've already said. User table with permissions/levels and code to control access.
My friend I know that the file can be restored to write and read by the command prompt in Windows But I still want code to disable the read-only option for the database from Windows..
is that possible? Please
I suspect it's possible to alter this via File Scripting code but it's not something I would ever bother with. My position is that it's so easy to circumvent that it seems pointless. I can only recommend that you research File Scripting Object. Sorry.
Maybe someone else will chime in with some code.
Yes, please If someone helps us
I can only reiterate what micron has said. What you're trying to do is a pointless exercise.
I have an Access database and I want to make it read-onlyIs there a way to make it read-only with the inability to view the read-only attribute?
this was your original request.
You can't prevent users from removing/changing the read only attribute unless you rely on your network security.
Trying to do this in access is not the appropriate place to try and prevent a generic user from changing file attributes in a folder they otherwise have read/write permissions.