kevcar40 <kevcar40@btinternet.comwrote in news:1194534229.051735.271020
@y27g2000pre.googlegroups.com:
Quote:
Hi
is it posible to check if another database is open?
i have several datasbase
the first is a dbase where the local data is maintained
on closing the database the table is exported to a holding table which
is linked to another database. ( this is done beacuse some users may
not have write access to the source file or it may be open)
the second database is linked to all the holding tables. Allowing the
all the tables to be linked and searched.
Problem is if someone has both open the export macro Action Fails.
>
What i want to do is check if the second dattabase is open
if not run a macro that exports the table
if it is open do not run the macro
>
let call the tables
>
source.mdb
and search.mdb
>
source.mdb exports to the holding table
>
can this be done in code
|
Maybe:
Private Function CanBeOpenedExclusively( _
ByVal FullPath As String) As Boolean
Dim d As DAO.Database
Dim p As DAO.PrivDBEngine
Set p = New PrivDBEngine
On Error Resume Next
Set d = p(0).OpenDatabase(FullPath, True)
CanBeOpenedExclusively = Not (d Is Nothing)
Set d = Nothing
Set p = Nothing
End Function
--
lyle fairfield