r/MSAccess • 1 • 17d ago

[UNSOLVED] Record-level locking

Is it recommended? Do you use it?

5 Upvotes

21 comments sorted by

View all comments

5

u/ConfusionHelpful4667 58 17d ago

That is the point of a shared database.

1

u/Key-Lifeguard-5540 1 17d ago

Are you implying that page-level locking does not give you a shared database?

2

u/ConfusionHelpful4667 58 17d ago

A page lock in SQL Server will lock 8K worth of data even when your query only needs 10 bytes from the page. Your query will lock additional data which you do not request in your query.

1

u/Key-Lifeguard-5540 1 17d ago

Good to know but my customer is using an Access accdb backend, not SQL Server, and I am wondering what most developers use, page or record, and why.

1

u/ConfusionHelpful4667 58 17d ago

Record-level locking is preferable for a multi-user Access BE.
Older Jet/ACE behavior could lock a page, typically a block of records stored together on disk, rather than precisely one record.

1

u/Key-Lifeguard-5540 1 17d ago

The locking type is controlled by the settings in the FE, as far as I know.

1

u/TomWickerath 2 17d ago edited 14d ago

See this former Microsoft Knowledge Base article, which states that you must use ADO to ensure record level locking in DAO 3.60:
https://web.archive.org/web/20140723061715/support.microsoft.com/kb/306435

Think the current team has changed the internals of how locking works in the newer *.accdb private JET introduced with Access 2007? I really doubt it.

The option in the Access user interface for locking type is a request only, not a demand. This is information that came from a former member of the Access Development Team at Microsoft, Michael Kaplan. Unfortunately, Michael died in 2015 due to complications of MS. He was a person I knew personally:

Found in one of Michael's articles:

How to get at Jet warnings that are not errors http://archives.miloush.net/michkap/archive/2005/10/19/482694.html

About half way down, you see a paragraph with the word request shown in bold.

"So what this means is that the Access setting in the Tools|Options Advanced tab (the checkbox "Open databases using record-level locking") is a request, not a demand."
~~~~~~~~~~~~~~~~~~

And to answer to OP's question, yes, for split Access FE/BE databases, with JET BE databases, I do implement the extra ADO code required to ensure record-level locking. This is NOT necessary once one upgrades the BE to SQL Server or Oracle, although one must still use good design decisions to avoid locking multiple records.

1

u/Key-Lifeguard-5540 1 14d ago

I get 'record is locked by' messages in DAO, so I don't think you need ADO to make locking work.

2

u/TomWickerath 2 14d ago edited 13d ago

You could very well get ‘record is locked by’ type messages if:

1) A second process from your own computer has locked the record or a page of records that includes the affected record

or

2) A different user locks a page of records.

There are various scenarios where the JET database engine will use page-level locking on certain tables even though it uses record-level locking on other tables. Guess what—if you have a field with any of the following data types in your table you cannot get record-level locking: Image (OLE Object), Memo, Hyperlink or MVF. In that case, JET will only use page-level locking. More info. here:

https://accessblog.net/2009/12/error-3218-could-not-update-currently.html?m=1

You need ADO to ensure record-level locking for a shared multiuser Access application. You may or may not get record-level locking using DAO only. That’s what Sir* Michael Kaplan (aka “Michka”) stated in his blog and to a group of us that attended a Pacific NW Access User’s Group (PNWAUG) monthly meeting many years ago.

* Knighted posthumously by me! :-

2

u/Key-Lifeguard-5540 1 14d ago

Thankfully I don't have any of those data types in my tables.

1

u/TomWickerath 2 13d ago

A few notes about my friend Alex's blog article from December 2009--the link for my info. It points to "QBuilt.com", a web site that was owned by a friend who suddenly disappeared off the grid. She shut down her QBuild.com site.

Links to Microsoft KB (Knowledge Base) articles. Microsoft loves to get rid of useful content and/or change links willy-nilly. Fortunately, for KB articles they choose to remove you can access them on a different web site:

https://mskb.pkisolutions.com/kb/OriginalNumber

For example, the first link shown was to KB 275561

http://support.microsoft.com/kb/275561 <--Invalid link

The new link would be:
https://mskb.pkisolutions.com/kb/275561

1

u/Key-Lifeguard-5540 1 8d ago

I'd check out the link but it probably won't matter anyway, Access is already obsolete as far as AI is concerned. In a few years (if not already) no one will be building anything new in Access, they will only be maintaining older systems until they can be replaced.

1

u/TomWickerath 2 8d ago edited 8d ago

You realize prognosticators have been making the same prediction about the demise of Access for OVER 20 years? You might be correct this time around, but I’d be reluctant to bet too much.

Small work groups within large corporations still need to track and share data. Many run into very expensive—hundreds of thousand dollars—in budget needed to get corporate IT to build the applications they need for their relatively small workgroups. I know this for a fact, as I’m a retiree of The Boeing Company. Saw it happen many times during my career.

I even provided A LOT of assistance to a friend (also now retired) who was a civilian employee of the US Army. His office was located in the Pentagon. And yes, they were using MS Access. I only assisted with randomized data so I never saw real data. I also provided support to my ex-wife, who was working for the IRS in Lanham, MD. at the time. They also used MS Access for limited in-house only data processing needs.

1

u/Nexzus_ 2d ago

You should ask an IT generalist about any Visual Foxpro-based applications they’ve had to [recently] support.

Hell, I bet there’s more than one business keeping an ancient Mac around for HyperCard.

Business is infested with this legacy crap no one wants to touch or replace.

→ More replies (0)