ACC: How to Determine If a Database Is Open ExclusivelyLast reviewed: August 29, 1997Article ID: Q117539 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. When a database is open exclusively, no other process or program can gain access to the database file. When a database is open not exclusively, other processes can gain shared access to the .mdb file. This article describes how to use the Open statement in code to determine if a database is open exclusively. 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 version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual.
MORE INFORMATIONThe Open statement's Shared argument enables you to attempt to gain access to a file in shared mode. If that file is the current database, and if it is open exclusively, a "Permission denied" error message occurs. No error message occurs if the database is open not exclusively, or shared. You can trap for this error to determine in what mode the database is open. The following sample function demonstrates how to use the Open statement to determine in what mode the current database is open. This function is most useful to programmers who want to warn users that the database being opened is in the incorrect mode:
REFERENCESFor more information about the Open statement, search for "Open Statement" using the Microsoft Access 97 Help Index. Keywords : kbusage PgmHowTo GnlMu Version : 2.0 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |