Unable to add record because of read only access (1 Viewer)

John Lee

New member
Local time
Today, 12:23
Joined
Dec 1, 2024
Messages
23
good morning folks,

I have the following code written on my front end form in the on load event and for some reason when a particular user opens up the database an error message appears saying read only access, and the Rs.AddNew is highlighted, but it doesn't happen for any of my other users!

'Get the user login ID on logging onto the database and record it in the tblUserLoginID table
Dim Rs As DAO.Recordset
Set Rs = CurrentDb.OpenRecordset("tblUserLoginID")
Rs.AddNew
Rs.Fields("strUserLoginID").Value = Environ("Username")
Rs.Update
Rs.MoveFirst
DoEvents
Rs.MoveLast
Rs.Close
Set Rs = Nothing

Any ideas on why this is the case, because the user is set up the same as the other users.

Thanks in advance
 
i am not sure if it is an update issue or what.
why can't you use an Insert query instead:

Code:
Currentdb.Execute "Insert Into tblUserLoginID (strUserLoginID) Values ('" & Environ$("Username") & "')"
 
i am not sure if it is an update issue or what.
why can't you use an Insert query instead:

Code:
Currentdb.Execute "Insert Into tblUserLoginID (strUserLoginID) Values ('" & Environ$("Username") & "')"
I'm not sure how I could use and insert query within the form load event
 
Just that form?, they can add other records?
Yes, its my front end form, when the user clicks on the shortcut icon the code identifies the user via the Code: Environ ("UserName") End Code and then I declare the record set (Rs) and set it to open in the tblUserLoginID table.

I don't understand why it works for others and not this one.

The user Environment ID's are:

richard.wallace
richard.holroyd
brett.ketley
nick.wiggins
craig.smith

the only one out of those above that it is not able to add a record for is brett.ketley.

I'm wondering if it could be to do with when he opens up the database via the shortcut, a message comes up saying that the database is read only, could that the problem, if so how do I resolve that.

Your assistance is most appreciated.
 
Well yes, that is the problem. :(
Is the DB in a trusted location on his computer?
Is the DB possible marked as a download from the internet, in which case you have to unblock it.

You do not work in a hospital do you? as I know a Richard Holroyd, who used to be in the Merchant Navy. :)

What is all this about?
Code:
Rs.MoveFirst
DoEvents
Rs.MoveLast
 
The most common reason for that behavior is incorrect file permissions. To correctly use an Access-based app, the user must have MODIFY permissions on the folder holding the file in question and must have MODIFY permissions on those files in the folder that are relevant to the app. USUALLY this means don't put irrelevant files in that folder, then grant MODIFY to all files in the folder.

Might be hard to set up the test if this is a popular app, but ... If there is a time when NO ONE is using the app, verify that there is no .LACCDB file in the folder where the back-end is located. Now have your unlucky user try to get in; i.e. log in and be the ONLY PERSON currently in.

Assuming success, look in the folder to see if a .LACCDB file was generated. If it was not, then Access made the file READ ONLY because it couldn't set up the lock file. (This is normal behavior for Access, not a bug.) This result is usually due to improper file permissions on the folder.

If the lock file WAS generated but the error still occurs, it could still be a permissions issue.

If you don't know how to check permissions, it's fairly easy. Find the back-end file. Right-click and select Properties. In the resulting complex form, find the Security tab. It will list some number of user and/or group tags. Click on one of the listed tags to select it. The permissions should be displayed in the bottom of the form. You WANT to see either MODIFY or FULL ACCESS. Lesser levels of permission won't work right.

Normally I would comment on the higher level folders (between the working folder and the disk's root folder) needing either READ or PASSTHRU, but since you say this user CAN open the app, those are most likely already in place. But the working folder needs more than just READ.
 
Is the DB split? You do not need to use shortcut.
you need to give each user his own FE.
 

Users who are viewing this thread

Back
Top Bottom