View Full Version : Grabbing User Name


Amy35
03-12-2002, 08:59 AM
I am running Access 2000 in an NT environment. I have a form where there's a text box for the LAN ID. I'd like to have that field filled automatically from the Window's registry. I know you can use %username% to grab the lan id. I'm just not sure where to code it so it can automatically be filled in when the form is opened. Thanks in advance for any help!

Amy

Jonathan Kok
03-12-2002, 11:20 AM
I'm not positive, but I believe the command is 'GetCurrentUserName', as in:

LogonName = GetCurrentUserName()

Hope that's it!

EDIT: Whoops...helps if I spell the command correctly.. http://www.access-programmers.co.uk/ubb/wink.gif

[This message has been edited by Jonathan Kok (edited 03-12-2002).]

David R
03-12-2002, 01:29 PM
I believe in a pure post-Win98 environment you can use = Environ("UserName"). The Environ function contains a lot of information, cycle through it with Environ(x).

HTH,
David R

Amy35
03-13-2002, 02:54 AM
Thanks for your help! I'll give it a try.

Amy