Hi John
Thanks for your reply TC-
I'm confused though - what you said and what I notice seem to disagree.
I'm trying to run this code:
CurrentDb.Execute ("delete * from tblLocalCompanyCityLookup")
First, you shouldn't use currentdb() like that. You should always cache
its value in a variable:
dim db as database
set db = currentdb
db. ... whatever
set db = nothing
For supporting references, just google the groups on "currentdb cache
kaplan" without the quotes.
Second, your code is not executing a stored query. RWOP is only useful
with stored queries. Queries that are executed through code, like the
one in your example, are /always/ executed with the permissions of the
user who is running the code. In that regard, /all/ such queries are
effectively RWOP queries. You can include the "WITH OWNERACCESS OPTION"
phrase, or not, as you please, & it will make no difference to a query
that is executed through code.
The table tblLocalCompanyCityLookup has no permissions for members of the
users group.
If I log in as the owner of the table, the query executes.
If I log in as a 'user', it says I don't have permissions on the table.
As expected! The owner of an object always has (or can regain) full
access to that object. And if the 'user' in question does not have
access to the table, either directly, or through his group membership,
then: he will not get access to the table!
IOW the example you give is nothing to do with using owner-access
queries. An owner access query is only useful when (1) it is a stored
query, and (2) you carefully choose the /owner/ of the query - distinct
from the user /running/ the query.
I said I was intimidated by the allowbypass code because in reading through
the newsgroup archives, I've seen that people have had problems with
ChangePropertyDdl and I don't really understand what it's doing - setting a
property only an admin can change. ??
Yes - but don't use vague terms like "an admin"! If you set the 4th(?)
parameter of the CreaateProperty method to True, then, the only users
who can change the value of that property, are members of the Admins
group of the workgroup file which was in effect when the database was
first created.
HTH,
TC