MS Access - "file already in use" error on split database - ms-access

I have a split database in MS Access 2010 on Windows 7.
The back end is on a networked drive in a folder that only some people have write permissions; everyone has read permissions.
Every user has their own copy of the front end stored on their local machine.
Both BE & FE are set to open as shared, not exclusive, for all users.
If a user with read-only permissions tries to get on while another user with read-only permissions is on, they can get on fine.
If a user with read-only permissions tries to get on while a user with write permissions has it open, they get a message saying " file already in use" and they can't open the database.
If a user with write permissions tries to open the database while a user with read-only permissions has it open, it opens as read-only for this user as well.
Do ALL users of a split database need full access? I really don't want everyone to be able to make edits. Anything I can do to get this to work?

The issue has certainly something to do with the fact that the read-only clients can't manage the .laccdb lock file since they don't have write permission to the shared folder in which the database file resides.
When the database is opened in shared mode, each client will create or update the lock file.
It's likely that since read-only clients can't create the lock file, they fall-back to believing they are in exclusive mode.
Once a full-access client creates the lock file, any subsequent client will attempt to use it, and read-only clients will fail since they can't update the lock.
Some documentation regarding lock files:Introduction to .ldb files
If you want to solve your issue, you must grant full access to the folder for all clients, but you can restrict access to the .accdb database file itself to the group of clients that are not supposed to be able to modify data in it.
Alternatively, if you are not using Access 2007/2010 features, you can revert to using an older .mdb file as a backend and use their old-style group security features.
Ultimately, if you really want to control access, you may need to roll-you-own security scheme from within the client, forcing users to log-in (or use their the identity of their machine) and update your forms' data edit properties depending on what that particular user/machine is allowed to do.

Related

editing and adding records blocking in multiuser mode

Im using msaccess 2010 on Windows 7 and faced the following problem: in multiuser mode editind ALL of record and adding new record blocked in all forms when some user working with database, in single user mode all work perfect.
Database is separated to front-end and back-end parts. Back-end part is located on network drive in directory with full right for all users, copies of front-end part are on users computers.
In client settings: Default open mode - shared, Default record locking - no lock, open database by record-level locking -on
In forms properties - allow add, edit, delete - yes, block records - no.
What could be the problem?
In most cases, this should just work.
Several things to check.
first up, the shared folder where the data part exists needs FULL rights. That means create file rights, and delete file rights. When a access database is opened, then it creates a 2nd file in that same back end folder. That 2nd file is how access handles and manages multi-user operations. If users dont' have create file rights, and delete file rights to that folder, then that mutli-user locking file cannot be created, and thus in most cases, the result is a read-only database.
Next up, do check your forms. You do NOT want the settings to lock the WHOLE table. That is this setting:
So, if you set above to "all records", then of course only one user can edit that table the form is based on.
That setting is a per form by form basis, and thus you do NOT have a global wide setting for this. And you should ALSO check reports - they should have all no reocrds, since you can lock a whole table for some speical reports - and in 99% of cases, you don't need nor want that.
but, check the shared folder rights. the users need read/write AND ALSO file create, and file delete rights. If they don't have such rights to that folder, then in most cases you find the result is a read only database.

Share a mdb file over network, for many computers, can't edit the application

The company is using an old Delphi software, that uses a .mdb file as database.
I can't change the way the application works, I don't have it's source.
We are facing many problems such as:
Lock problems
When an user adds an entry, it doesn't update the database, it only appears locally
The lock problems are solved for now, currently, the problem is that only the first user that connects to the .mdb can edit, add and delete entries, the other users do that to, but the changes are not applied to the db, it seems it's only apply locally, on the user machine.
My question is, is .mdb supposed to work with many users over the network(3~4 people)?
What Is there anything I can do to make this software works well with the .mdb file, with many users?
Remembering that I cannot split the .mdb, as I cannot edit the Delphi application.
You don’t mention that if this in the past work fine in a multi-user environment. However, keep in mind that users MUST have full read/write AND ALSO file create and delete rights.
The reason for the create and delete rights is that because this is a “file based” system without a server process, then a locking file is created in the same directory as the back end mdb file. When the first user opens the file, and they don’t have FULL RIGHTS to the folder, then the file is opened in exclusive mode, and all additional users will be read only. This thus explains your symptom of first user in, but additional users don’t work. (the additional users will be read only – and obviously the Delphi software does not detect this problem). So you can view data – but no saving of data can occur.
So you need to ensure that all users have the ability to create that locking file. It is created by the first user, and any additional user opening the back end ALSO needs rights to that file (so don’t by mistake have permissions to the folder set on a per user basic, since then the first user in will cause JET to create the locking file but with permissions to that first user!. Once again this will mean additional users will be read only. So additional user MUST be able to open the locking file, and the first user in MUST be able to create the locking file. In fact open Access will open the database (mdb) as exclusive and prevent multi-user when the locking file cannot be created.
When the last user leaves the database (or in your case leaves the Delphi application), then the back end file is closed and ALSO THE locking file is deleted by the database engine (JET)
So this sounds like your IT folks did not give wide open permissions to the back end folder. You “can” run the database with file delete rights removed, but I much suggest that the locking file being re-cycled is also a good thing since over time it can become damaged etc.
So based on your symptoms, this is a VERY common occurrence in Access, and this problem is fixed by giving all users sufficient permissions to create files in the same folder as the back end. (and not permissions based on per user).
ALL users must be able to create + open + use that locking file created by the first user opening the mdb file. This locking file creation is automatic and managed by the JET database and not the Delphi program.
Yes, it can work with x ppl on a network.
Make sure the Access database is set to open in shared mode, which is the default setting.
Tools menu, click Options.
On the Advanced tab, under Default open mode, click Shared.
Use this Powershell script:
Get-SmbOpenFile | Where-Object -Property ShareRelativePath -Match ".mdb" | Close-SmbOpenFile –Force

Access 2010 allowing multiple users/ Implementing group security

I'm creating an Access 2010 database and would like some clarification when it comes to concurrency and security. What I would like is upon starting the app only a menu form to be displayed with several buttons including a login button. Most buttons would be disabled until after the user logs in at which point based on their permission group; Viewer(Deafault), Worker, Editor, Admin.
Also, Admin should be the only one to be able to see the access database while the others are restricted to seeing the forms only.
I was just testing the default concurrency implementation but saving my database to a shared network and having myself and a co-worker try to access it. Found out if one accessed the database it locked it from others, and if we both tried at the same time it became read-only.
So I'm just looking for tips on how to start this.
For an Access database all users must have as a minimum read, write and modify permissions on the folder in which the database resides. This is because MS Access creates a lock file and if the second user does not have permissions to modify the lock file, the cannot get access to the database. Delete permissions may also be useful, to remove the lockfile when they are the last person out.

MS Access User Level Security for Form to be Read but Table to be Hidden

Can user level security enable someone to access a form, but not access a table? I have a form that is connected to a table using a"SELECT" command. It does not "UPDATE" or "DELETE". I'd like for the user to access my form, but I don't want them to be able to view the details in the underlying table. I've tried all sorts of combinations in the user level security wizard, but for some reason, my form comes up blank, unless I give complete access to the user to do anything. Any ideas? By the way, I'm on Access 2003.
You could make an MDE and give it to your users. If you do this, the users won't be able to see anything but the user interface you have provided.
If your tables are in the same Access database as the forms and queries, you first need to "split the database" into a frontend and backend. See:
http://databases.about.com/od/tutorials/ss/splitaccessdb.htm
for information on how to do this. The frontend contains everything but the tables. The backend contains the tables. The frontend is linked to the backend tables using "linked table" objects in the frontend.
Once the database is split, open the frontend in Access, and create an MDE by selecting Tools/Database Utilities/Make MDE File from the menu bar. The MDE is what you provide to the users. They open it the same way they would any other database, except that they can't design any of the objects.
Make sure that you have an AUTOEXEC macro defined in the frontend, so that when the MDE is opened by the user, it has an entry point. The user cannot see any of the objects in the MDE, so if you don't have an AUTOEXEC macro to open the first form, nothing will happen when they try to open the MDE.
If you need the ability to manage the linked tables in the MDE by allowing the user to connect to the backend database with a File/Open dialog, see the following article:
http://www.mvps.org/access/tables/tbl0009.htm
OF course, none of this precludes your users from opening the backend database. If you need stronger security, you can upsize the backend database to SQL Server Express. More info here:
http://office.microsoft.com/en-us/access/HA102755371033.aspx
What you're looking for is a RWOP query. That means "run with owner permission."
To make it work, assuming you've already run the security wizard on your front-end and back-end databases and have removed permissions for the users to even read the tables, you then create a saved query as the recordsource of your form. In the properties of the query, it is set by default to RUN PERMISSIONS as "user's." Change that to "owner's" and save the query. The query will run with whatever permissions on the base table the owner of the query has. If you are running as an administrator with full permissions, you'll want to set the permissions of the saved query to read-only (or create the query under a user logon that has read-only access to the tables -- it's much easier to do the former).
Some caveats:
user-level security is tricky. If you miss even one step outlined in the ULS security white paper, your app won't be secured. The way to test this is to open Access with a default workgroup file and then see if you can access the objects in your database logged on as the default admin user. If you can, then you made a mistake somewhere along the line.
user-level security is crackable by anyone who wants to. This doesn't mean it's not useful, it just means that it's not bullet-proof. I don't worry about that so much, as I consider security as much a people problem as a technical problem -- you have to give employees sufficient privileges to do their work, and you have trust them that they won't abuse the privileges you've given them.
if you're running Access 2007 and using the ACCDB format, RWOP queries are not available to you, as Jet user-level security is not supported for the ACCDB format. If you're using MDB format, though, it will work just fine in A2007.

MS Access - what are the lowest required permissions for the backend file and for the folder containing it

I maintain an ms-access application splitted to frontend and backend files.
The frontend file is in the users conputers.
The backend file is in a shared folder in the server.
What is the lowest permissions required?
can I give some of the users only read-only permissions in that folder? (or hide it from them in some other way) but still enable them to view the data?
How should I give the best security to the data file and to the folder containing it?
Unfortunately, the lock file (ldb) must be created, updated and deleted. If a user with insufficient permissions opens the database, it will be locked for all other users, therefore all your users need Read/Write/Delete permissions on the back-end.
EDIT #1
The lock file must be created every time the database is opened, this includes via linked tables, and deleted when the database is closed. If a lock file exits and the database is closed, it indicates a problem has occurred. You will also run into problems with compact and repair if it is run with insufficient permissions.
Edit #2
Security for Access is quite a large subject and depends to a great extent on your environment and requirements, for the back-end, it ranges from a database password, which is tissue thin, but quite suitable for most offices, to Access security, which can be complicated and has been dropped in 2007. Here is a link http://support.microsoft.com/kb/207793 for a download for the Microsoft Access Security FAQ for versions < 2007.
Information on security for 2007 can be found here http://www.microsoft.com/technet/security/guidance/clientsecurity/2007office/default.mspx.
Many have suggested that you must give FULL permissions to users, but this is not true. You need only give them MODIFY permissions -- you can deny them DELETE permission, which is a good idea, as it prohibits the users from "accidentally" deleting your data file.
It is true that for a user with DELETE permissions, the LDB file will be deleted on exit when that user is the last user exiting the database. But it is not required that the LDB file be deleted -- indeed, in Access 2 and before, the LDB files were not deleted on exit, but just left there hanging around. This generally has no downside, but occasionally the LDB file gets corrupted and causes problems and really does need to be deleted and recreated afresh.
What I do is have two classes of database users (as defined in custom NT security groups specific to my Access application(s)) -- DBAdmins and everyone else. The DBAdmins have FULL permissions, everybody else only CHANGE. The result is that any time a DBAdmin exits as the final user, the LDB is deleted. This setup works really well, and I've been using it for well over a decade.
Using a hidden share for your back end is really only "security by obscurity," and not really worth the effort. Sophisticated users can figure it out through any number of methods (depending on how you've locked down your front end):
view the MSysObjects table and find
the CONNECT string for the tables,
which will identify the hidden
share.
examine the results of
CurrentDB.TableDefs("name of linked
table").Connect in the immediate window in
the VBE
Now, if you've properly secured your app using Jet user-level security (and it's very easy to think you've secured your database and find out that there are holes, simply because it's really easy to forget some of the crucial steps in the process), they won't be able to do this, but even if you have, Jet ULS security is crackable (it's pretty easy to Google it and find cracking software), so is not really something you should depend on 100%.
Yes - it resolves down to file access permissions as well as read/write. You can't execute any type of data update stuff (you'll get "operation requires an updateable query") unless the user supplies credentials that allow them to write, or you allow write on the file.
Running a query requires only read access.