Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 8th, 2007, 03:05 PM
kevcar40
Guest
 
Posts: n/a
Default check if database is open

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
Default 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
Default 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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles