check if database is open
am 08.11.2007 16:03:49 von kevcar40
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
thanks
kevin
Re: check if database is open
am 08.11.2007 17:16:39 von none
Use the "DIR" function to check for the .LDB file. If source.mdb is open the
there will be a source.ldb in the same directory.
"kevcar40" wrote in message
news:1194534229.051735.271020@y27g2000pre.googlegroups.com.. .
> 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
>
>
> thanks
>
>
> kevin
>
Re: check if database is open
am 08.11.2007 18:10:50 von Lye Fairfield
kevcar40 wrote in news:1194534229.051735.271020
@y27g2000pre.googlegroups.com:
> 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