ACC: Cannot Check to See If Database Was Opened Exclusively (94035)
The information in this article applies to:
- Microsoft Access 1.0
- Microsoft Access 1.1
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
- Microsoft Visual Basic for Applications 1.0
This article was previously published under Q94035
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
In a multiuser environment, you cannot use the OpenDatabase method to find
out if the current database was opened exclusively. If you try 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.
CAUSE
Microsoft 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.
RESOLUTION
Currently there is no workaround 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.
STATUS
This behavior is by design.
REFERENCES
For more information about the OpenDatabase method, search the Help Index
for "OpenDatabase method."
Modification Type: | Minor | Last Reviewed: | 8/15/2005 |
---|
Keywords: | kbprb kbProgramming KB94035 |
---|
|