ACC2000: Second OpenRecordset Fails with Run-Time Error 3008 (197952)
The information in this article applies to:
This article was previously published under Q197952 SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills.
When you use the OpenRecordset method in a Visual Basic for Applications
procedure, you may receive the following error message:
Run-time error '3008':
The table '<tablename>' is already opened exclusively by another user,
or it is already open through the user interface and cannot be
manipulated programmatically.
This error occurs the second time that you use the OpenRecordset method in
your procedure. The first line in which you use the OpenRecordset method to
open a recordset based on the same table does not generate an error.
CAUSE
A snapshot-type recordset based on the same underlying table is already
open. You may have opened this recordset by opening a form whose Recordset
Type property is set to Snapshot, or by using the OpenRecordset method in a
Visual Basic for Applications procedure and designating the type with the
dbOpenSnapshot constant.
The Microsoft Jet database engine places a shared table-read lock on the
underlying table when you open a snapshot-type recordset. This lock
persists until you close the recordset in code or close the form. If the
recordset is still open and your code uses OpenRecordset with the constant
dbDenyWrite to open another recordset based on the same table, the lock on
the table is upgraded from a shared table-read lock to a more restrictive
exclusive deny-write lock. Even if you then close the second recordset and
use the Idle method with the constant dbFreeLocks, the exclusive deny-write
lock on the table remains in effect; the Jet database engine upgrades locks
to be more restrictive but does not downgrade them to be less restrictive.
Therefore, you receive the error message described in the "Symptoms"
section when you open another recordset based on that table.
STATUS
This behavior is by design.
REFERENCES
For more information about the constants that you can use with the
OpenRecordset method, click Microsoft Access Help on the Help menu, type
OpenRecordset method in the Office Assistant or the Answer Wizard, and
then click Search to view the topic.
Modification Type: | Minor | Last Reviewed: | 7/13/2004 |
---|
Keywords: | kbprb KB197952 |
---|
|