ACC1x: Form Handle Not Released When Closed with Access BasicLast reviewed: June 8, 1997Article ID: Q95644 |
The information in this article applies to:
SYMPTOMSAfter closing a form (using the Close macro action) that was opened through Access Basic code, the file handle for the table that the form is based on is not released. Because the file handle is not released, no functions that require exclusive use on that table can be executed (for example, deleting the table). When a function that needs exclusive use of that table is executed, the following error will occur:
Couldn't lock table '<tablename>'; currently in use. CAUSEYou are not guaranteed that the user interface (UI) will be synchronized with the underlying Microsoft Access code in all cases. In this case, the record locking is done behind the scenes. Microsoft Access releases the table when it hits its idle loop (that is, the UI optimization).
RESOLUTIONAfter the form is opened in Access Basic code, insert a DoEvents command before the function that needs exclusive use of the table, to cause Microsoft Access to yield execution to the operating system, so that it can process events. When the DoEvents command occurs it allows Microsoft Access to process the pending unlock sequence.
STATUSThis behavior no longer occurs in Microsoft Access version 2.0.
MORE INFORMATIONThe following steps provide example code that reproduces this error. There is a comment in the Access Basic code identifying where to insert a DoEvents command to resolve this error.
Steps to Reproduce Problem
|
Keywords : kbprg PgmErr PgmOthr
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |