Re: Grant admin rights to user temporarily



scuba:

One of the points of not giving a user rights is to also not give them
rights to give themself rights... When you say:

> "I need to be able to give them rights"

.... you are not logged on when they are running your code... they are.
Consequently the code, acting with the permissions of your user, can't give
your user more rights.

You don't say what the code does that needs these special rights, but it's
possible you could solve your problem with the help of a "run with owner
permissions" (RWOP) query -- that's a query that you enable to run with the
permissions of a user that has more permissions, regardless of who the
actual user is who runs it.

>From Help topic "Change a query's permissions":

"you can assign others permission to view the data your query returns or, in
the case of an action query, to run the query, even if they are otherwise
restricted from viewing the query's underlying table or query. "

Hope that helps,

Graham

"scuba79" <scuba79@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CDF85DBA-5906-49C9-A350-3C50603B5FA6@xxxxxxxxxxxxxxxx
>I have a secured database using a mdw file that was created with the
> database. I have some code that will be run under one of the user
> accounts.
> That account does not have any rights to the tables. I need to be able to
> give them rights to the tables just as long as the code is running. Here
> is
> the code that I'm currently using.
>
>
> While Not rst.EOF
> Set con = db.Containers("Tables")
> Set doc = con.Documents(rst("Name"))
> doc.UserName = "pdlead"
> doc.Permissions = dbSecFullAccess
> con.Documents.Refresh
> rst.MoveNext
> Wend
>
> ImportLoc = GetFileName
>
> this runs without any problems, however, when I click on another button.
> I
> get an error message stating that the user does not have permissions to
> "work" with the tables.
>
> Any assistance is greatly appreciated
>

--
---------------------------------------------------
Graham Wideman
Microsoft Visio MVP
---------------------------------------------------
Book/Tools:
Visio 2003 Developer's Survival Pack
Resources for programmable diagramming at:
http://www.diagramantics.com



.


Loading