ACC2: TransferDatabase Fails in Code, Not in Immediate WindowLast reviewed: May 14, 1997Article ID: Q117612 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. When you use the TransferDatabase action within a transaction in an Access Basic function, you receive the error message:
Couldn't update, locked by another user on this system.However, if you set a breakpoint in the function and single-step through it, you do not receive the error message.
CAUSEThis error occurs only when you run a TransferDatabase action nested in a transaction on a table that is already attached to Microsoft Access. The error occurs because a transaction updates the MySysObjects table, placing a write lock on the table. The write lock is not released while the transaction is still active. The DoCmd TransferDatabase statement causes Microsoft Access to start a new session and try to create a new table. However, the Microsoft Jet database engine needs to update the MySysObjects table because it is adding a record, but the MySysObjects table is still locked.
RESOLUTIONDo not use nested TransferDatabase actions in transactions against attached tables. Instead, use the following techniques:
STATUSMicrosoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.
MORE INFORMATION
Steps to Reproduce ProblemCAUTION: Following the steps in this example will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database. NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.
REFERENCESFor more information about the TransferDatabase action, search for "TransferDatabase," and then "TransferDatabase Action" using the Microsoft Access Help menu.
|
Additional query words: programming attaching
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |