"File sharing lock count exceeded." error message during large transaction processing (815281)



The information in this article applies to:

  • Microsoft Office Access 2003
  • Microsoft Access 2002
  • Microsoft Access 2000

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

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: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor 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

  1. Click Start, and then click Run.
  2. Type regedit, and then click OK.
  3. In Registry Editor, locate the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Jet 4.0

  4. In the right pane of Registry Editor, double click MaxLocksPerFile.
  5. On the Edit DWORD Value dialog box, click Decimal.
  6. Modify the value of the Value data box as required, and then click OK.
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 properly, 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:
  1. Open Microsoft Access.
  2. Open a database. In the left pane, click Modules.
  3. In the right pane, right-click <Module Name>, and then click Design View.

    Note If there are no existing modules, create a new one.
  4. On the Microsoft Visual Basic -<Database Name>-[<Module Name> (Code)] window, click Immediate Window in the View menu.
  5. In Immediate Window, enter the following code
    DAO.DBEngine.SetOption dbmaxlocksperfile
    				,15000
  6. Press the ENTER key to run the line of code.

    Note This temporarily sets the MaxLocksPerFile value to 15,000.
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.

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 additional information, click the following article number to view the article in the Microsoft Knowledge Base:

305995 PRB: Error "3050 Could Not Lock File" When You Connect to a Jet Database on a Novell Server

REFERENCES

For more information about customizing registry settings for the jet database engine, click Microsoft Access Help on the Help menu, type Customizing Windows Registry settings for Microsoft Jet in the Office Assistant or the Answer Wizard, and then click Search to view the topic. For Access 2000, see the search result Customizing Windows Registry Settings for Microsoft Jet. For Access 2002, see About Customizing Your Application Environment with User Profiles and Run-time Options.

For more information about SetOption method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type SetOption method in the Office Assistant or the Answer Wizard, and then click Search to view the topic. For Additional Information, visit the following Microsoft Knowledge Base Articles:

198633 ACC2000: "File Sharing Lock Count" Error During Synchronization

209940 ACC2000: Error Message: There Is Not Enough Disk Space or Memory


Modification Type:MinorLast Reviewed:6/8/2004
Keywords:kberrmsg kbRegistry kbprb KB815281 kbAudDeveloper kbAudITPRO