BUG: CreateDynaset Holds Lock on Index if No Records Return
Article ID: 153018
Article Last Modified on 3/2/2005
APPLIES TO
- Microsoft Visual Basic 4.0 Standard Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 16-bit Enterprise Edition
- Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
This article was previously published under Q153018
SYMPTOMS
After opening a Dynaset that contains no records with a SQL statement that
refers to an indexed field, attempting to access that table from another
application can cause the following error:
Couldn't save; currently locked by <User_Name> on machine <Machine_Name>
To work around this problem, add a call to the Idle method of the DBEngine
object immediately after the call to OpenRecordset. Add the following line
of code:
DBEngine.Idle dbFreeLocks
CAUSE
The error occurs because the Jet engine is not, by default, releasing the
lock on the index page after opening the Recordset. This behavior only
occurs when the Recordset returned contains no records. It occurs with Jet
2.5 and Jet 3.0, but doesn't occur with Jet 1.1.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Keywords: kbbug kbdatabase kbpending KB153018