ACC2000: Cannot Check to See If Database Was Opened ExclusivelyID: Q210592
|
Moderate: 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 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.
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 technique to test whether a database has been opened exclusively. The technique does not work because Access does not check the option flags.
Option Explicit
Sub TestOpenDB()
Dim db As DAO.Database
Set db = OpenDatabase("C:\Program Files\Microsoft Office\Office\" & _
"Samples\Northwind.mdb", False)
db.Close
End Sub
TestOpenDB
For more information about the OpenDatabase method, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "OpenDatabase method" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
Additional query words: prb
Keywords : kbprg kbdta AccCon PgmObj KbVBA
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 13, 1999