If you've implemented user level security, you can use the CurrentUser() function to grab their Access username. I would make the button invisible rather than disabled.
If CurrentUser() = 'shiro' then
Me.cmdWhatever.Visible = False
Else
Me.cmdWhatever.Visible = True
End If
You can also do this based on the group rather than just the user. There's code in the security FAQ you can use to determine if a user is a member of a group.
http://support.microsoft.com/?id=207793
If you haven't used ULS, then you can grab the user's Windows login name and act on that. You'll find the code to retrieve this at
http://www.mvps.org/access/api/api0008.htm

Signature
Joan Wild
Microsoft Access MVP
> Hi All,
> Is it possible to disable a control such as command button
> to a certain user?.How to do that?
shiro - 02 Jun 2007 04:36 GMT
Thank's Joan,
But more question:
After implement user level security wizard,Why does
my user cannot open/run the query in the database?
If you've implemented user level security, you can use the CurrentUser()
function to grab their Access username. I would make the button invisible
rather than disabled.
If CurrentUser() = 'shiro' then
Me.cmdWhatever.Visible = False
Else
Me.cmdWhatever.Visible = True
End If
You can also do this based on the group rather than just the user. There's
code in the security FAQ you can use to determine if a user is a member of a
group.
http://support.microsoft.com/?id=207793
If you haven't used ULS, then you can grab the user's Windows login name and
act on that. You'll find the code to retrieve this at
http://www.mvps.org/access/api/api0008.htm
--
Joan Wild
Microsoft Access MVP
> Hi All,
> Is it possible to disable a control such as command button
> to a certain user?.How to do that?
Joan Wild - 02 Jun 2007 15:11 GMT
The user (or a group they are a member of) need at minimum Read Data permissions on the query. In addition you should set the Run permissions property of the query (View, Properties in design view) to Owner.

Signature
Joan Wild
Microsoft Access MVP
> Thank's Joan,
> But more question:
[quoted text clipped - 26 lines]
>> Is it possible to disable a control such as command button
>> to a certain user?.How to do that?
shiro - 03 Jun 2007 03:51 GMT
I've set the query's run permission to owner.but still get the same.
It just occured to action querys.
When I see the User/Group permission in security menu,
the option Open/Run of query is disabled.Any suggestion?.
The user (or a group they are a member of) need at minimum Read Data
permissions on the query. In addition you should set the Run permissions
property of the query (View, Properties in design view) to Owner.
--
Joan Wild
Microsoft Access MVP
> Thank's Joan,
> But more question:
[quoted text clipped - 28 lines]
>> Is it possible to disable a control such as command button
>> to a certain user?.How to do that?
Joan Wild - 03 Jun 2007 13:52 GMT
You need to give the users Read Data permission on the query. There is no Open/Run permission on a query.

Signature
Joan Wild
Microsoft Access MVP
> I've set the query's run permission to owner.but still get the same.
> It just occured to action querys.
[quoted text clipped - 43 lines]
>>> Is it possible to disable a control such as command button
>>> to a certain user?.How to do that?
shiro - 04 Jun 2007 03:02 GMT
I did Joan,
I have check the option read data for that user.
But still unable to open/run the query
You need to give the users Read Data permission on the query. There is no
Open/Run permission on a query.
--
Joan Wild
Microsoft Access MVP
> I've set the query's run permission to owner.but still get the same.
> It just occured to action querys.
[quoted text clipped - 45 lines]
>>> Is it possible to disable a control such as command button
>>> to a certain user?.How to do that?
Joan Wild - 04 Jun 2007 14:20 GMT
What message do you get when you try to open the query as the user?

Signature
Joan Wild
Microsoft Access MVP
>I did Joan,
> I have check the option read data for that user.
[quoted text clipped - 57 lines]
>>>> Is it possible to disable a control such as command button
>>>> to a certain user?.How to do that?
shiro - 05 Jun 2007 08:06 GMT
'Run Time Error 3033'
"You on't have the necessary permission to use the 'query' object.
Have your system administrator or the person who created
this object estabilish the appropriate permission for you. "
What message do you get when you try to open the query as the user?
--
Joan Wild
Microsoft Access MVP
>I did Joan,
> I have check the option read data for that user.
[quoted text clipped - 59 lines]
>>>> Is it possible to disable a control such as command button
>>>> to a certain user?.How to do that?
Joan Wild - 05 Jun 2007 14:41 GMT
Does it actually say 'query' or does it say the name of some query? You need to give as a minimum 'Read Data' permission on that query.

Signature
Joan Wild
Microsoft Access MVP
> 'Run Time Error 3033'
>
[quoted text clipped - 70 lines]
>>>>> Is it possible to disable a control such as command button
>>>>> to a certain user?.How to do that?
shiro - 06 Jun 2007 03:53 GMT
I did Joan,
I guve Read Data permission for all querys
in my db.
Does it actually say 'query' or does it say the name of some query? You
need to give as a minimum 'Read Data' permission on that query.
--
Joan Wild
Microsoft Access MVP
> 'Run Time Error 3033'
>
[quoted text clipped - 72 lines]
>>>>> Is it possible to disable a control such as command button
>>>>> to a certain user?.How to do that?
Joan Wild - 06 Jun 2007 15:03 GMT
What is the actual name of the object given in the message in the single quotes?

Signature
Joan Wild
Microsoft Access MVP
>I did Joan,
> I guve Read Data permission for all querys
[quoted text clipped - 86 lines]
>>>>>> Is it possible to disable a control such as command button
>>>>>> to a certain user?.How to do that?
shiro - 09 Jun 2007 04:13 GMT
'Monthly Sales Report'
'Pivot Excel' .
That they are.
What is the actual name of the object given in the message in the single
quotes?
--
Joan Wild
Microsoft Access MVP
>I did Joan,
> I guve Read Data permission for all querys
[quoted text clipped - 88 lines]
>>>>>> Is it possible to disable a control such as command button
>>>>>> to a certain user?.How to do that?
Joan Wild - 09 Jun 2007 15:34 GMT
And what permissions do the users have on 'Monthly Sales Report' (I take it this is a report?) and 'Pivot Excel'?

Signature
Joan Wild
Microsoft Access MVP
> 'Monthly Sales Report'
> 'Pivot Excel' .
[quoted text clipped - 99 lines]
>>>>>>> Is it possible to disable a control such as command button
>>>>>>> to a certain user?.How to do that?
shiro - 11 Jun 2007 08:51 GMT
Their ability are :
Read Design,Read Data,Insert Data,and Update Data
for both tables and querys.
And what permissions do the users have on 'Monthly Sales Report' (I take it
this is a report?) and 'Pivot Excel'?
--
Joan Wild
Microsoft Access MVP
> 'Monthly Sales Report'
> 'Pivot Excel' .
[quoted text clipped - 101 lines]
>>>>>>> Is it possible to disable a control such as command button
>>>>>>> to a certain user?.How to do that?
Joan Wild - 11 Jun 2007 14:39 GMT
You have to remember that I can't see what you are seeing on screen.
You are getting a message that you don't have permission to 'some' object (be it a table/query/form/report). You need to double check the permissions on *that* object. Clearly the user does not have the right permissions.

Signature
Joan Wild
Microsoft Access MVP
> Their ability are :
> Read Design,Read Data,Insert Data,and Update Data
> for both tables and querys.
>
> And what permissions do the users have on 'Monthly Sales Report' (I take it
> this is a report?) and 'Pivot Excel'?