469,922 Members | 1,910 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

Open mdb exclusive, permissions problem.

A97. Split database. Frontend DB1.MDB. Backend DB1BE.MDB. Tables are
linked between DB1 and DB2.

From my testing, if I open DB1 exclusively using /excl the backend
DB1BE is not opened exclusively.

If I open DB1 but have no tables open and then open up DB1BE
exclusively, DB1BE will open exclusive. But if I then attempt to open a
linked table in the frontend DB1 I'm informed I can't use the table
because the file is in use.

If I open DB1 and also open a linked table in DB1 and then attempt to
open the backend DB1BE, it will inform me it can't open the backend
DB1BE exclusively.

OK, so the /excl switch is associated with the file it opens. Whatever
backend files are associated with the file are not affected. I learned
something today.

But I am having some problems. I guess its associated with security. I
don't know. I'm hoping you can tell me what's going on.

I have 2 subroutines below that I run that produces my confusion and
errors. I open up DB1. From the Debug window I run OpenBEExcl. I get
an error "3033. You don't have the permissions to use DB1BE..." This
happens EVERYTIME I open DB1. If I then enter
? IsDBExclusive(Currentdb.name)
and then rerun OpenBEExcl it works and no error 3033!

If I were to run
? IsDBExclusive("C:\Apps\DB1BE.MBB)
first instead of passing Currentdb.name it tells me DB1BE is not
exclusive. But that doesn't affect my OpenBEExcl problem. I will get
the error 3033. The ONLY way I don't get the 3033 error is to first run
IsDBExclusive on the currentdb. From then on I can run any routine
without error.

Can you tell me anything about error 3033 No permissions error? I've
checked the back end. I'm the owner of everything. I have all rights
for all objects. Why would it tell me I have no permissions on a
backend database that the front end is linked to?

Any clarification is appreciated.
Sub OpenBEExcl()
Dim dbs As Database

Set dbs = OpenDatabase("C:\Apps\DB1BE.MDB", True)
MsgBox "Open"
Set dbs = Nothing

End Sub
Function IsDBExclusive(strDBName As String) As Integer
'Q117539 KB article
' Purpose: Determine if the current database is exclusive.
' Returns: 0 if database is not open exclusively.
' -1 if database is open exclusively.
' Err if any error condition is detected.

Dim db As Database
Dim hFile As Integer
hFile = FreeFile

If DIr$(strDBName) <"" Then

On Error Resume Next
Open strDBName For Binary Access Read Write Shared As hFile

Select Case Err
Case 0
IsDBExclusive = False
Case 70
IsDBExclusive = True
Case Else
IsDBExclusive = Err
End Select
Close hFile
On Error GoTo 0
MsgBox "Couldn't find " & db.name & "."
End If
End Function

Oct 12 '07 #1
0 4666

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Eino Mäkitalo | last post: by
reply views Thread by Wayne | last post: by
1 post views Thread by buclas | last post: by
2 posts views Thread by jennifer | last post: by
6 posts views Thread by =?Utf-8?B?RyBIdXN0aXM=?= | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.