Error 3052 MaxLocksPerFile exceeded

  • Thread starter Thread starter Peter Hibbs
  • Start date Start date
P

Peter Hibbs

Access 2003

I am running the code below :-

Dim rst As Recordset

Set rst = CurrentDb.OpenRecordset("tblProducts", dbOpenDynaset)
Do Until rst.EOF rst.Edit
rst!Surcharge = txtSurcharge
.... some other fields updated here
rst.Update
rst.MoveNext
Loop
....

On the rst.Edit line I get the error :-

Run time error 3052.
File sharing lock count exceeded. Increase MaxLocksPerFile registry
entry.

This happens after 9109 iterations. The table tblProducts has 19234
records so it is a bit inconvenient if the user wants to update more
than 9000 records.

The MaxLocksPerFile value on my PC is set to 0x0000251c (9500) but I
really don't want to have to change that value as this DB will be used
by several companies that I don't have direct contact with.

Also, I don't want to have to use an Update query to make the changes
as the VBA code (not shown here) allows the user numerous options to
change/update various fields which would be difficult to manage in
SQL.

Anyone have any ideas on a fix for the problem.

Peter Hibbs.
 
Take a look at the SetOption Method in help.

(DBEngine.SetOption dbMaxLocksPerFile, 20000)

Glenn
 
Glenn

Excellent, that works perfectly (and it does not change the Registry
setting permanently which is useful).

Thanks again.

Peter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top