In code I would like to see what user is logging in.

J

JW

Basically I have a check box that I only want a certain user to be able
to see. In code how do I see the user/computer in order to write an

If user is "John Hancock" then
Checkbox.visible =true
end if


Thanks
 
A

Alex White MCDBA MCSE

if environ("USERNAME") = "Alex" then
me.Checkbox.visible = true
end if
 
D

Douglas J Steele

Hate to be a party pooper, but I wouldn't use environment variables for
security: they're too easy to reset.

Instead, use the API call outlined in
http://www.mvps.org/access/api/api0008.htm at "The Access Web".

Then you can use Lynn's short circuit:

Me.Checkbox.Visible = (fOSUserName() = "Alex")
 
A

Alex White MCDBA MCSE

Yes agreed, but that is one of those var's that is set by windows and to
reset before access can screw with it, is shell to to DOS set the var and
then run Access from that specific command prompt. But the API wins every
time in my view as it is a well trodden path. So no party today for me.
 
A

Alex White MCDBA MCSE

Hi Lynn,

Personally I cannot stand user level security, I have used it extensively in
the past and in my humble view, adds complexity to an already complex
network infrastructure, e.g. new user joins the company, set them up on the
network, then set them up in access. The only thing it is good for, is the
granular level of security that can be applied to either a user or group for
objects within the database.

But we could discus the pros and cons of each system forever as they all
have their strengths and weaknesses.
 
Top