Checkbox on a form can ony be set/reset by specitic user

  • Thread starter Thread starter mrs
  • Start date Start date
M

mrs

I have a checkbox on a form that I want only the
Administrator or user Steve to be able to check or
uncheck.

I set the Default Value for the control to:

=IIf(CurrentUser()="Steve" Or "Admin",[ApprovedChkBx].
[Enabled]=True,[ApprovedChkBx].[Enabled]=False)

However, this did not work.

Any suggestions?

Matt
 
You wouldn't do that in the default value property. You would use the form
open event.

If CurrentUser()="Steve" Or CurrentUser()="Admin" then
me![approvedChkBx].Enabled = true
else
me![approvedChkBx].Enabled = false
end if

However, that implies that the 'admin' user has permissions. In a properly
secured database that user should have no permissions. Anyone using their
default system.mdw would have the permissions you assigned to Admin.
 
Joan,

Thanks for you help. It worked. However, I new at DB
securities and am a little confuse about you statement
concerning default system.mdw. I used the Security
Wizard to set up the security access. User Matt is the
only user with admin rights. How can someone alter my
database with default system.mdw?

Thanks

Matt
-----Original Message-----
You wouldn't do that in the default value property. You would use the form
open event.

If CurrentUser()="Steve" Or CurrentUser()="Admin" then
me![approvedChkBx].Enabled = true
else
me![approvedChkBx].Enabled = false
end if

However, that implies that the 'admin' user has permissions. In a properly
secured database that user should have no permissions. Anyone using their
default system.mdw would have the permissions you assigned to Admin.

--
Joan Wild
Microsoft Access MVP
I have a checkbox on a form that I want only the
Administrator or user Steve to be able to check or
uncheck.

I set the Default Value for the control to:

=IIf(CurrentUser()="Steve" Or "Admin",[ApprovedChkBx].
[Enabled]=True,[ApprovedChkBx].[Enabled]=False)

However, this did not work.

Any suggestions?

Matt


.
 
mrs said:
Joan,

Thanks for you help. It worked. However, I new at DB
securities and am a little confuse about you statement
concerning default system.mdw. I used the Security
Wizard to set up the security access. User Matt is the
only user with admin rights. How can someone alter my
database with default system.mdw?

Thanks

Matt

There is a difference between being a member of the Admins Group, and the
Admin User. The Admin user is common to all workgroup files; the Admins
Group is not. If you used the wizard in 2002, you should be fine.

But I question why you are testing for CurrentUser() = 'Admin'. That means
the Admin User, not a member of the Admins Group. There is a function in
the FAQ you can use to determine if a user is a member of the Admins Group.
 
Joan,

Thanks again for your reply. I'm using CurrentUser()
= 'Admin' b/c I don't know what I'm doing. I read some
more and am not using Admin anymore. Everything seems to
be working now. I'm trying to figure how to open up my
file and automatically put the password and user name
in. I have "P:\Data\Matt\Eng
Discrepancies3.mdb" /user "Matt" /pwd "admin".

Thanks once again,

Matt
 
mrs said:
Thanks again for your reply. I'm using CurrentUser()
= 'Admin' b/c I don't know what I'm doing. I read some
more and am not using Admin anymore. Everything seems to
be working now. I'm trying to figure how to open up my
file and automatically put the password and user name
in. I have "P:\Data\Matt\Eng
Discrepancies3.mdb" /user "Matt" /pwd "admin".

When using switches on the command line you must provide the full path to
msaccess.exe

"path to msaccess.exe" "path to mdb" /user "Matt" /pwd "admin"

This will use your default workgroup. That may be fine if your default
workgroup is the one you secured your mdb with. Normally folks leave their
default as system.mdw and add the switch to use their secure mdw to the
command line.

"path to msaccess.exe" "path to mdb" /wrkgrp "path to mdw" /user "Matt" /pwd
"admin"

Additionally, it is unusual to put the username/password right there in the
target, since anyone can open the shortcut and see this information. But if
you are confident this isn't an issue, then it's fine to leave it in.

Please don't take this wrong as I'm reading between the lines, but did you
follow the steps outlined in the security FAQ to secure your database? I'm
thinking you may have just gone to the security menu and started playing.
You need to follow the steps exactly, or your database won't be secure.

What version are you using, and what methods did you follow?
 
You need to use that logic, but do it in the form's on open event.

something like...



ApprovedChkBx.Enabled=False

If CurrentUser()="Steve" Or CurrentUser()="Admin" then
ApprovedChkBx.Enabled=True
End If




Rick B


I have a checkbox on a form that I want only the
Administrator or user Steve to be able to check or
uncheck.

I set the Default Value for the control to:

=IIf(CurrentUser()="Steve" Or "Admin",[ApprovedChkBx].
[Enabled]=True,[ApprovedChkBx].[Enabled]=False)

However, this did not work.

Any suggestions?

Matt
 
I'm not taking anything in the wrong way...You have been
a tremendous help...And yes I made a copy of the original
database and started playing with security. I look for
the sucurity FAQ in help but it seemed as if helped
bounced around security topics. Is the FAQ in the help?
Can you direct me to it?

Thanks again,

Matt
 
I'm not taking anything in the wrong way...You have been
a tremendous help...And yes I made a copy of the original
database and started playing with security. I look for
the sucurity FAQ in help but it seemed as if helped
bounced around security topics. Is the FAQ in the help?
Can you direct me to it?

It's sometimes difficult to 'read' a person's experience. The FAQ is a
document you can download for free from MS.
http://support.microsoft.com/?id=207793

I have also outlined the detailed steps at
www.jmwild.com/AccessSecurity.htm

but also get the FAQ, as it has more than the steps to secure.
 
Back
Top