Re: DBEngine.CompactDatabase and Permissions



No, it's not a big issue. But if standard users shouldn't need this
permission then there is always the risk that one of them will either
deliberately or mistakenly open the back-end exclusively and lock others
out. True, the risk is small but if it brings no benefit, then what's the
point? When you use the security wizard you notice that some of the
standard groups (such as the update and read-only groups) are not allowed to
open exclusively.

My only reason for posting was that it was not clear that you need this
permission to compact from Access but not to run the CompactDatabase method.
Anyway, after all this fuss, I'll probably find that someone will manage to
open and save the back-end with MS Word which puts the current concern about
OpenExclusive permissions into perspective.




"Joan Wild" <jwild@xxxxxxxxxxxxxxxx> wrote in message
news:eHn0d2BVGHA.5248@xxxxxxxxxxxxxxxxxxxxxxx
I don't really see the problem with granting users (or more appropriately
the group they are a member of) exclusive open permission?

--
Joan Wild
Microsoft Access MVP

Anthony England wrote:
"Joan Wild" <jwild@xxxxxxxxxxxxxxxx> wrote in message
news:%23PnjZAAVGHA.4956@xxxxxxxxxxxxxxxxxxxxxxx
Anthony England wrote:

<<Do you agree that Bob does not need permission to open the
database exclusively, in order that he can run:
DBEngine.CompactDatabase "C:\BackEnd.mdb", "C:\Compacted.mdb">>

Knowing what I know now, I would have answered:
" I agree. He does not need this permission."

There's a difference between whether he can and whether he should. If no
one is in the backend when the code is run, then it will work.

However, you should get an exclusive lock to do the compact. What if
someone opens the backend during the compact?

--
Joan Wild
Microsoft Access MVP


Hi Joan
This is part of routine which will automatically backup the data. It
will be carried out when the last user closes the front end if a
backup has not already been taken. One of the first steps is to
temporarily re-name the backend, then take a copy before I do further
processing on the copy. If I can re-name the file, then I know it
was not being used and I can proceed safely.

I do not know if it is possible for someone else to open the file
while <DBEngine.CompactDatabase Path1, Path2> is running - perhaps it
is, as David Epson says that Jet no longer opens the file. Could
someone open it without any error in the above code so I would not
know that all went according to plan? I don't know.

However, I need to balance the risk of granting each and every user
with Open Exclusive permissions on the back end with the risk of
someone opening the temporary file with an obscure name like
~temp01.mdb in the couple of seconds it exists (assuming it is
possible).




.


Loading