Opening A Split Database Exclusively

G

Guest

If I open a Front-End database in Exclusive mode, is the back-end exclusive
also? I have a multi-user application that requires updating every day from
an external, non-Access database. This works best if the database is open
exclusively. I have not yet split the multi-user version because I want to
make sure I can easily open both parts exclusively when I do this update.

TNX

Amy
 
G

Guest

Also, is there a way for Access to test whether it is open exclusively? I'm
trying to make this update easy enough for someone else to do if I'm not
here, so I'd like the procedure to halt if the database isn't open
exclusively.
 
J

Joan Wild

No, the backend is not opened exclusively when the frontend is.

You can determine if the database is opened exclusively by checking for the
existence of a ldb file in the backend folder. Note that you mustn't have
any object open in the frontend that is bound or that will cause the ldb to
appear.
If Len(Dir("path to backend.ldb")) = 0 Then
'it doesn't exist - no one in right now
else
'it does - someone is using it
end if

Once you know there is no one using the backend you can then open it
exclusively, thus keeping others out until you've completed what you need to
do.

Dim dbs as Database
Set dbs = OpenDatabase("path to backend", True)
'do your stuff
 
G

Guest

Is there any way to open the backend exclusively from the front end or
otherwise keep people out without closing the front end and opening the back
end? Maybe it would make more sense to just have the whole update procedure
in the back end to start with.

Amy
 
J

Joan Wild

The code I posted will open the backend exclusively from the frontend.

The 'True' option does this.
 
T

tw

Sorry to jump into your post Amy, but I have a similar problem, and maybe
Joan can help us both...

The post came up at just the right time. I used the code you posted below
with some modification.

I put the check to see if the backend is open into a function that will
return true or false.

I changed my "set rs = dbs.openrecordset..." instead of
"currentdb.openrecordset..." however in this particular project I have two
backend databases. One does not need to be open excl the other does. (I
left the one openrecordset statements for the db that does not need to be
exclusive at currentdb.openrecordset because it is a different link
different file. The first encounter with a backend table is with the
exclusive one and it opened fine, then when I got to the one that does not
need to be exclusive, I got the message that I (my computer) has put the db
in a state that it cannot be opened. Without the code to open exclusively
both dbs open fine.
 
J

Joan Wild

tw said:
I changed my "set rs = dbs.openrecordset..." instead of
"currentdb.openrecordset..." however in this particular project I have two
backend databases. One does not need to be open excl the other does. (I
left the one openrecordset statements for the db that does not need to be
exclusive at currentdb.openrecordset because it is a different link
different file. The first encounter with a backend table is with the
exclusive one and it opened fine, then when I got to the one that does not
need to be exclusive, I got the message that I (my computer) has put the
db in a state that it cannot be opened. Without the code to open
exclusively both dbs open fine.


Post the code you are using, as I am having trouble following your
description.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top