Article ID: 286153 - View products that this article applies to.
This article was previously published under Q286153
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access database (.mdb).
For a Microsoft Access 2000 version of this article, see 209940
When you perform an operation on a table, you may receive the following error message if the operation creates a large number of page locks:
If you run an action query on a large table, you may receive the following error message:
There isn't enough disk space or memory.
There isn't enough disk space or memory to undo the data changes this action query is about to make.
The page locks required for the transaction exceed the MaxLocksPerFile value, which defaults to 9500 locks. The MaxLocksPerFile setting is stored in the Windows registry.
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756There are several ways to work around this problem:
(https://support.microsoft.com/kb/322756/ )How to back up and restore the registry in Windows
Method 1: Changing MaxLocksPerFile in the registryUse Registry Editor to increase the MaxLocksPerFile value under the following key:
Note that this method changes the registry setting for all applications that use Microsoft Jet database engine version 4.0.
Method 2: Using SetOption to change MaxLocksPerFile TemporarilyNOTE: 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.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The SetOption method temporarily overrides values for the Microsoft Jet database engine keys in the registry. The new value remains in effect until you change it again, or until the DBEngine object is closed.
Note Changes made to the MaxLocksPerFile setting by using the SetOption method will only be available through the current session of Data Access Objects (DAO). Queries that are run through the Microsoft Access user interface will still use the settings in the registry.
The following code sample sets MaxLocksPerFile to 200,000 before executing an update operation inside a transaction:
Method 3: Setting the UseTransaction property in an action queryIf a stored action query causes the error, you can set its UseTransaction property to No. Note that if you do this, you cannot roll back your changes if there is a problem or an error while the query is running:
The MaxLocksPerFile setting in the registry prevents transactions in the Microsoft Jet database engine from exceeding a specified value. If a transaction tries to create locks in excess of the MaxLocksPerFile value, the transaction is split into two or more parts and partially committed.
Steps to reproduce the problemThe following example uses a Visual Basic procedure to create a table with 10,000 records in it, and then modifies the table in order to cause the error message:
Article ID: 286153 - Last Review: June 23, 2005 - Revision: 7.3