"ManningFan" <ma********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Arno - Your advice is... well... Worthless. But thanks for playing.
Talk about calling the kettle black here. What you talking about?
The user stated that they are using workgroup files, and assign logons to
ms-access users...
>WILBY...! CurrentUser returns "Admin" most of the time.
Again, talk about worthless advice. Did you not bother to read the post? If
you assigning user names, then IT WILL BE A COLD DAY IN HELL THAT THE LOGON
name will be Admin. IT WILL NOT BE "AMDIN" MOST OF THE TIME. It be a very
rare event. So, now, who exactly is giving useless advice here?
If fact, if the user has secured the workgroup file correctly, then likely
the admin logon has little, or no privileges. Don't confuse the admin logon
with that of admins "group" privileges.
Further, the suggesting to use environment valuables is not a very good one.
Batch files, windows start-up settings and even USERS can edit/change the
environment values. You are aware that you can go right click on "my
computer". Click on the advanced tab, and at the bottom you will a button to
"edit" environment variables.
In other words, a user can create a logon environment value, and IT WILL
HAVE NO RELATION TO THAT ACTUAL windows logon.
And, the advice about using scripts is also really good, as many companies
do lock down their computers..and do not allow the use of windows scripts.
So, what is left if you need to grab the windows user logon?
Well, as mentioned, if users have password windows logons, the use of
environment variables is not very good, as any user can go and use the above
advice to create a environment value and assigning it ANY VALUE they want.
So, your environment value in this case will NOT match the windows logon.
The recommend solution is to use the windows user api. ms-access examples
can be found here:
You can get the current network logon name with:
http://www.mvps.org/access/api/api0008.htm
And, the current computer name with:
http://www.mvps.org/access/api/api0009.htm
And, if using ms-access security, then currentuser() will return the
ms-access logon.
I often log all 3 of the above values in some applications.
So, not only is your advice 100% wrong on what value currentuser() will
return IN THIS CASE!!!, the advice to use scripts is not very good either.
and, father, the advice to use environment values is also not very good, as
once again they can be changed. I can change my environment values to your
user logon...but, if I don't have your password, I certainly can't log on as
you. So, using the above api's are faster, more reliable (they will work all
the way back to windows 95, and also work in windows Vista - that can't be
said for environment variables). And, not only are the api's time and tested
over the last 10 years, they are also not subject to tampering with as
compared to environment values
So, as I read your response, it is fine that you made a mistake, or perhaps
did not realise that the person was using workgroup files (you should be big
enough to just simply admit you made mistake). However, your other two
pieces of advice (using scripts), and using environment values are also of
dubious value, and especially so when MUCH better choices such as the api's
exist.
What not just admit you make a mistake here, and the advice you gave was
really not very good here?
Or, if you have better information, please explain to me how, or why that
"most of the time" currentUser() will return admin when using a secured
application ?
I am all open to learning here....and you should also address the issue that
environment values can be easily changed, where the above api's cannot be
tampered with...
This newsgroup is a great place to learn new things...you just have to be
more open to the suggestions here...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com