FreeLocks
Please, Sir, Can I Have Some More?
I recently encountered just such a situation that required the use of FreeLocks. My project involved three concurrently running apps all using pessimistic locking on the same database. You could normally expect that the error handling (below) would work…
On Error goto ErrorHandler ' Database stuff such as creating dynasets; seeks; edits; addnews and updates.
Exit sub
ErrorHandler:
If (Err = 3186) or (Err = 3260) then ' Database locked
do until … ' 3 seconds passed
DoEvents
Loop
Resume
EndIf
EndSub
But alas, VB, not! In this situation the table remained locked indefinitely. The ONLY way to unlock the table is to use the FreeLocks statement when encountering the locking errors (followed by a DoEvents).
![]()