Error: File sharing lock count exceeded

R

Rod

I have a linked table with about 24k entries.
I want to loop all the way through it and change the value of one field.

The code is below, but basically reads the field to a sting, does something
and writes it back.

When I run it, 9k records are processed, then I get the following error.

Error Number: 3052
Error Description: File sharing lock count exceeded. Increase
MaxLocksPerFile registry entry.

If I import the table and open with dbOpenTable it works fine.
Is there a neat way around this as I don't want to get involved with the
registry. At the time no one else will be using either of the two databases
so I don't need to lock records but I don't know how to tell Access that.

many thanks in advance


Rod

PS, using Office XP, on Windows XP

____________________________________________________________

Private Sub Remove_Digits_From_Code()

'removes digits and space from right hand side of code in Classes table

Dim Clss As DAO.Recordset
Dim TC As String

Set Clss = Db.OpenRecordset("Classes", dbOpenDynaset)

Clss.MoveFirst
Do
TC = Nz(Clss!
Code:
, "")
TC = Left(TC, InStr(TC, " ") - 1) 'removes space and all chars after
it

Clss.Edit
Clss![Code] = TC '  overwrite old version
Clss.Update

Clss.MoveNext
Loop Until Clss.EOF

Clss.Close
Set Clss = Nothing

End Sub
 
T

TC

Tim Ferguson said:
UPDATE Classes
SET Code = TRIM(Code & "");


Um, not the same as:
Left(TC, InStr(TC, " ") - 1) 'removes space and all chars after


UPDATE Classes
SET Code = Left (Code & " ", InStr (Code & " ", " ") - 1)

And, how dare he remove spaces from TC?!

Cheers,
TC
 

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

Top