Tuesday, August 4, 2026

Is Anyone Still Logged On? How to Tell if Anyone is Using Your Microsoft Access Database

Before you compact a shared back end, restore a backup, replace a file, or make a table design change, it helps to know whether anyone is still using the database. Making changes while somebody is halfway through entering invoices is a fantastic way to turn an ordinary Tuesday into a much more interesting Tuesday.

Fortunately, Access leaves behind a pretty useful clue when a shared database is in use. It is not a perfect user-tracking system, but it is usually enough to tell you whether you should proceed with maintenance or stop and investigate first.

When Access opens a database for normal multi-user use, it generally creates a small companion file in the same folder as the database. If your shared file is an ACCDB or ACCDE database, the companion file uses the .laccdb extension. Older MDB databases use the older .ldb extension.

For example, if your shared back-end file is named CustomerData.accdb, Access will normally create a file named CustomerData.laccdb while someone is connected to it.

Think of the lock file as the occupied sign on a restroom door. If the sign is there, someone may be inside. That does not necessarily mean someone is actively doing anything at that exact moment, but it is enough of a warning that you probably should not start tearing out plumbing.

The lock file is part of the behind-the-scenes machinery Access uses to coordinate multiple users. It helps the database engine manage record locks and prevent users from stepping on each other's changes. You do not normally need to do anything with it. Do not rename it, move it, or edit it just because you see it sitting in the folder. It is not clutter. It is Access doing its job.

The simplest check is to browse to the folder containing the shared back end and see whether the LACCDB file exists. Be sure you are looking at the back end on the server or shared network folder, not at a user's front-end file. Each user should normally have a separate front end on their own computer, and that front-end lock file is not what matters for back-end maintenance.

If the back-end LACCDB file is not there, you can be reasonably confident that nobody is currently using that back end. That is usually a good time to perform your maintenance. If you are going to make design changes, compact the file, or restore a backup, opening the database exclusively is still a smart extra precaution. That prevents someone from wandering in halfway through the job.

If the LACCDB file does exist, treat the database as potentially occupied. Someone may be entering orders, running reports, editing records, or simply sitting at lunch with Access open. Either way, do not assume the back end is available just because nobody immediately admits to using it.

There is one important wrinkle: lock files can become stale. If Access crashes, Windows crashes, the computer loses power, Wi-Fi disappears, or the network connection drops unexpectedly, Access may not get the chance to remove the LACCDB file properly. The lock file remains behind even though nobody is actually connected.

That means the presence of a lock file is a warning, not absolute proof of a live user. The safest procedure is still to confirm that everyone is out of the application before deleting a stale lock file. And please make absolutely certain you are deleting the tiny LACCDB file, not the ACCDB database itself. It is surprisingly easy to click the wrong file when you are tired, in a hurry, or operating before coffee has had a chance to do its work.

If you have confirmed that everyone is out, you can usually delete the stale lock file. Access will create a new one automatically the next time someone opens the shared back end. If you are unsure whether the file is stale, do not make assumptions during a busy workday. Ask your users, check their workstations, or wait until after hours.

There is also a small but important detail with split databases. A user can have the front end open without immediately creating a lock file for the back end. This often happens when the startup form is an unbound main menu that has not yet opened a linked table, run a query, or displayed any back-end data.

In that situation, the user may technically have Access open, but they have not yet connected to the shared data file. Once they open a customer form, process an order, run a report, or otherwise touch a linked table, Access will normally open the back end and create the LACCDB file. For maintenance purposes, that is what matters: whether anyone is actually using the shared back-end file.

You can also check for the lock file programmatically with a small VBA function. The basic idea is simple: give the function the full path and file name of the back-end ACCDB file, remove the ACCDB extension, add .laccdb, and use the VBA Dir function to see whether that file exists.

The function returns a Boolean value. If the LACCDB file is found, it returns True. If the file is not found, it returns False. You can then call that function from a button on your main menu, from an automated maintenance routine, or before code attempts to compact, copy, replace, or otherwise work with the back end.

This is especially handy if you have an overnight process scheduled for midnight or 3:00 AM. Before the process starts manipulating the data file, it can check for the lock file and decide not to continue if users may still be connected. It is a simple safety check that can prevent a lot of trouble.

If your database uses more than one back-end file, you can perform the same check for each one. Some larger Access applications split tables across multiple back ends for archival data, email history, reporting tables, or other purposes. In that case, a more advanced routine can loop through the linked tables, identify the unique back-end files, and check each one without forcing you to maintain a long list by hand.

Sometimes you may want to know more than just whether the file exists. The contents of a lock file can often reveal the workstation names of computers connected to the database. If you open the LACCDB file in a text editor, you may see names such as the computer name and an Access user entry. The Access user name is often just Admin these days, so the workstation name is generally the more useful piece of information.

This can help you narrow down who might still be connected. If the lock file shows a workstation named ACCOUNTING-PC-3, you at least know where to start looking. It is not a complete security or audit system, but it can be enough to answer the practical question: "Who has this thing open?"

For more reliable tracking, consider building a login and logout system into your application. A good system can record the Windows user name, computer name, login time, and logout time. Then you can look for a login that does not have a corresponding logout. That is much more useful in a larger environment where walking around and asking everyone whether Access is open becomes a daily scavenger hunt.

Another useful approach is an administrative maintenance flag. Before you begin maintenance, place a small text file in the shared folder indicating that the database is offline. When users open their front end, the startup code checks for that file before touching any linked tables. If the maintenance flag exists, the application displays a message telling them the database is temporarily offline and then closes.

That gives you a controlled way to keep users from reconnecting while you compact the back end, restore a backup, or make design changes. It is much better than hoping nobody decides to open the database at exactly the wrong moment.

So the rule of thumb is simple. No lock file usually means you are clear. A lock file means someone may be connected, so verify before doing maintenance. And if a lock file remains after everyone is definitely out, it is probably stale and can be removed carefully.

The embedded video includes the complete VBA walkthrough, including how to create the lock-file check function and place it on a main menu button. It is a small tool, but it can save you from some very large headaches.

Live long and prosper,
RR

No comments:

Post a Comment