Remove Read-Only (1 Viewer)

Learn2010

Registered User.
Local time
Today, 08:20
Joined
Sep 15, 2010
Messages
415
I copied a database and am making changes to several things within the copied DB. One of the things I am doing is removing the right click option. I am using the following code:

START OF CODE

Public Function doRightClick()
Dim obj As Object
Dim frm As Form

For Each obj In DBEngine.Workspaces(0).Databases(0).Containers("Forms").Documents
DoCmd.OpenForm obj.Name, acHidden
For Each frm In Forms
frm.ShortcutMenu = False
Next
DoCmd.Close acForm, obj.Name, acSaveYes
Next
End Function


END OF CODE

I can run this and it works. But, when I close the database I get the message "Cannot update. Database or object is read-only." I never did anything to make it read-only and I cannot find any setting in the database that makes it read-only. Does anyone have an idea why this is happening and how can I get rid of the read-only?

Thank you.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:20
Joined
May 21, 2018
Messages
3,195
Is it read only in Explorer properties? Any chance you copied onto a cd or hardrive and back? I have an unencrypted external drive and anything moved off of there ends up being read only. However, normally you would see a message at startup.
 

isladogs

CID Moderator
Staff member
Local time
Today, 13:20
Joined
Jan 14, 2017
Messages
13,421
I can't see why that code would make it read only.
However I think it you should move the first 'Next' after the DoCmd line.

It would also help if you indented your code and used the code tags button (#) on the post thread window

EDIT
You can also disable default shortcut menus in Access options. No code needed
 

Learn2010

Registered User.
Local time
Today, 08:20
Joined
Sep 15, 2010
Messages
415
It is not read-only in the properties. I copied it from one folder to another.

I disabled the shortcut menus and it got rid of the right click option.

Thanks.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:20
Joined
Feb 19, 2002
Messages
29,007
The code modifies form objects and saves them. You can only do this if you have exclusive control over the database and once you do it, everyone else will be locked out because you have modified objects.

Multiple users can only update shared data. Access no longer supports concurrent object updates by multiple users. Period. I believe that even the source code add in that used to allow this functionality is no longer available.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom