Connecting Tech Pros Worldwide Help | Site Map

check if database is open

  #1  
Old November 8th, 2007, 03:05 PM
kevcar40
Guest
 
Posts: n/a
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

  #2  
Old November 8th, 2007, 04:25 PM
paii, Ron
Guest
 
Posts: n/a

re: check if database is open


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" <kevcar40@btinternet.comwrote in message
news:1194534229.051735.271020@y27g2000pre.googlegr oups.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
>
>
thanks
>
>
kevin
>

  #3  
Old November 8th, 2007, 05:15 PM
lyle fairfield
Guest
 
Posts: n/a

re: check if database is open


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
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if Database is Open motpid answers 4 December 20th, 2007 10:26 PM
Opened database is not visible shs answers 2 October 18th, 2006 10:55 AM
Determining if an Access Project is open Kenneth Courville answers 6 November 12th, 2005 10:49 PM
Determining if an Access Project is open Kenneth Courville answers 6 November 12th, 2005 10:22 PM