MaxLocksPerFile exceeded error - how to correct

P

Paul Doree

Hi,

I'm opening a table and deleting all the records (about 120.000 rows) using
the following:

Dim db As DAO.Database, mytable As DAO.Recordset
Set db = CurrentDb()
Set mytable = db.OpenRecordset("Trent Sickness", DB_OPEN_DYNASET)
Do Until mytable.EOF
mytable.Delete
mytable.MoveNext
Loop

I get the error message "File sharing lock count exceeded. Increase
MaxLocksPerFile registry entry."

I've found the registry entry, and the value is set to 251c. I'm not sure
what this means so am reluctant to amend it.

Can anyone help?
 
R

Ron Weiner

Wow that's the Long way around. Try one of these instead:

DoCmd.SetWarnings False
DoCmd.RunSql "Delete * from [Trent Sickness]"
DoCmd.SetWarnings True

OR

CurrentDb.Execute "Delete * from [Trent Sickness]", dbFailOnError

120K records deleted no muss no fuss.
 

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