Microsoft KB Archive/815281

= &quot;File sharing lock count exceeded…&quot; error message during large transaction processing =

Article ID: 815281

Article Last Modified on 12/12/2007

-

APPLIES TO


 * Microsoft Office Access 2007
 * Microsoft Office Access 2003
 * Microsoft Access 2002 Standard Edition
 * Microsoft Access 2000 Standard Edition

-



Important This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756 How to back up and restore the registry in Windows XP and Windows Vista



SYMPTOMS
When one or more users process many transactions in a multi-user environment, the transactions may fail with the following error message:

File sharing lock count exceeded. Increase MaxLocksPerFile registry entry.



CAUSE
The error occurs if the number of locks required to perform a transaction exceeds the maximum number of locks per file.



WORKAROUND
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To work around this problem, increase the maximum number of locks per file. To do this, use one of the following methods.

Method 1: Set the registry key to MaxLocksPerFile to increase the maximum number of locks per file
 Click Start, and then click Run. Type regedit, and then click OK. Use the appropriate method:  In Microsoft Access 2000, in Microsoft Access 2002, and in Microsoft Office Access 2003 that are running on a 32-bit Windows operating system, use Registry Editor to locate the following registry key:

In Microsoft Access 2000, in Microsoft Access 2002, and in Microsoft Office Access 2003 that are running on a 64-bit Windows operating system, use Registry Editor to locate the following registry key:

 In Microsoft Office Access 2007 that is running on a 32-bit Windows operating system, use Registry Editor to locate the following registry key:

In Microsoft Office Access 2007 that is running on a 64-bit Windows operating system, use Registry Editor to locate the following registry key:

 </li> In the right pane of Registry Editor, double click MaxLocksPerFile.</li> On the Edit DWORD Value dialog box, click Decimal.</li> Modify the value of the Value data box as required, and then click OK.</li></ol>

Note This method changes the Windows registry setting for all applications that use the Microsoft Jet database engine version 4.0.

Method 2: Use the SetOption method to temporarily change MaxLocksPerFile
Note The sample code in this article uses Microsoft Data Access Objects. For this code to run correctly, you must reference the Microsoft DAO 3.6 Object Library. To do so, click References on the Tools menu in the Visual Basic Editor, and make sure that the Microsoft DAO 3.6 Object Library check box is selected.

The SetOption method temporarily overrides the default number of locks per file. You set the default number of locks per file when you set the MaxLocksPerFile registry key. You set the new value by using the SetOption method. The new value is valid until you close the DBEngine object. To use Method 2, follow these steps: <ol> Open Microsoft Access.</li> Open a database, and then press Alt+F11 to launch the Visual Basic editor.</li> On the Microsoft Visual Basic -<Database Name>-[<Module Name> (Code)] window, click Immediate Window in the View menu.</li>  In Immediate Window, enter the following code. DAO.DBEngine.SetOption dbmaxlocksperfile,15000 </li> Press the ENTER key to run the line of code.

Note This temporarily sets the MaxLocksPerFile value to 15,000.</li></ol>

To process large transactions, set the MaxLocksPerFile value to meet your requirement, and then run the transactions in the session.

Changes you make to the MaxLocksPerFile setting by using the SetOption method are available only for the current session.

<div class="moreinformation_section">

MORE INFORMATION
The MaxLocksPerFile setting determines the maximum number of locks Microsoft Jet places against a file. The default MaxLocksPerFile value is 9,500. However, do not change this value if you are working on a Novell NetWare server, because the maximum server record locks per connection is 10,000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

305995 Error &quot;3050 Could Not Lock File&quot; when you connect to a Jet database on a Novell server

<div class="references_section">