ACC: Cannot Check to See If Database Was Opened ExclusivelyLast reviewed: August 29, 1997Article ID: Q94035 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. In a multiuser environment, you cannot use the OpenDatabase method to find out if the current database was opened exclusively. If you attempt to open the current database with the OpenDatabase method in Visual Basic for Applications, and the current database was originally opened exclusively, the database opens and no error is returned. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual. NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access versions 1.x and 2.0. For more information about Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x or the "Building Applications" manual in Microsoft Access version 2.0.
CAUSEMicrosoft Access ignores the option flags for all opens except the first for a given window's task, so a system administrator cannot use this to test whether a database has been opened exclusively. The technique does not work because Microsoft Access does not check the option flags.
RESOLUTIONCurrently there is no work around in Microsoft Access version 7.0 or earlier. In Microsoft Access 97, you receive a trappable error:
Run-time error 3045: Couldn't use '<filename>'; file already in use.However, if you run any Visual Basic procedure that uses the CurrentDB() function or the DBEngine object before you execute the OpenDatabase method, the error does not appear.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce BehaviorThe following Visual Basic procedure successfully opens the current database, even if the current database has been opened exclusively.
REFERENCESFor more information about the OpenDatabase method, search the Help Index for "OpenDatabase method." Keywords : kbprg PgmOthr PgmObj Version : 1.0 1.1 2.0 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbprb Solution Type : Info_Provided |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |