Link to home
Start Free TrialLog in
Avatar of mlcktmguy
mlcktmguyFlag for United States of America

asked on

Increase ADO Recordlocks in code

I have found that the following works to increase recordlocks when using DAO file handling

DAO.DBEngine.SetOption dbMaxLocksPerFile, 300000

Is there a way to increase the record locks while using ADO file handling?  I tried

ADO.DBEngine.SetOption dbMaxLocksPerFile, 300000

but the compiler didn't like that.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mlcktmguy

ASKER

Thanks, after looking thru the linked article I used
Dim rsIn2 As ADODB.Recordset
'
CurrentProject.Connection.Properties("Jet OLEDB:Max Locks Per File") = 400000
'
Set rsIn2 = New ADODB.Recordset
rsIn2.Open selectString, CurrentProject.Connection, adOpenKeyset, adLockOptimistic

Open in new window


It worked.
All of my tables are linked to the backend so I don't explicitly establish a connection anywhere in the code.

Does the 'CurrentProject.Connection.Properties("Jet OLEDB:Max Locks Per File") = 400000' statement have to be used each time a recordset is opened.  Or, since all of my tables are linked can I set it once in the code and it will apply to any recordet that is opened.?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent, thank you.