Douglas,
I did not know that you could not name the module with the same name as a function--it works flawlessly! This is great, seriously. I have a bunch of client/server applications I manage at work. This will definitely come in handy. Thank you very much.
Best regards,
Todd
What happens? Do you get an error? If so, what is it. Do you get the wrong
Id? If so, is there any pattern in what you're getting?
You didn't happen to name the module fOSUserName, did you? (Modules cannot
be named the same as any functions or subs contained within them)
It works fine for me with WinXP (Home) and Access 2003: I just tested again
before posting. (And no, there are no references you need to set)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Douglas,
I have tried using this module a hundred times--I am not being factitious
either. I cannot seem to be able to call the function from an event
procedure, for example:
Dim vUser As String
vUser = fOSUserName()
I have Windows XP and Microsoft Access 2003. Could I be missing a reference
possibly? I would really like to use this method; however, I just haven't
managed to get it to work.
Thanks,
Todd
I always recommend very strongly against using environment variables for
this purpose, as they're trivial to reset. Far better is to use the API call
shown in
http://www.mvps.org/access/api/api0008.htm at "The Access Web"
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Chris,
I know where you are coming from--I too have a number of applications in
shares controlled by NTFS permissions via Active Directory.
I just capture the system's %username% environmental variable; however, this
approach isn't necessary the most robust. A savvy computer user my
potentially circumvent this measure by opening a prompt and setting the
variable value. Nonetheless, here's an option.
=Environ$("UserName")
NOTE: Copy the above exactly as displayed.
You can set a field value's default using the above script or a variable in
an event procedure.
Best regards,
Todd
Well, I have spent 45 minutes + on the web looking for information on this,
and cannot find any, other than I need to use the GetUserName function.
My group is using a database that will require date/time stamping, and
certain people not being able to see certain things. Due to the nature of
the group, there is no need to set up "proper" security - rather, all I need
is for the NT/Win2K login ID to be grabbed, date/time stamped, and entered
into a table. The database is stored on a shared drive only accessible by
the people in the group, which is why security is not a concern. Any
ideas???? Thanks in advance,
Chris