Get Windows User

  • Thread starter Dimitris Nikolakakis
  • Start date
D

Dimitris Nikolakakis

I would like to keep in each record of table in access project the Windows
User and Compauter Name that has created the record or modified the record.
I will write the code in form properties on an event.

Thanks in advance

Dimitris Nikolakakis
 
D

Douglas J. Steele

I always cringe when people suggest using an environment variable for this
purpose, given how easy it is to reset an environment variable.

All that's necessary is to open a DOS box, use the SET command to set the
USERNAME variable to whatever you want, then open Access using a command
line in that same DOS box. While the USERNAME isn't actually reset, it is
for the duration of that DOS box, so Access will see whatever the user tells
it to see.

Far safer, in my opinion, is to use the GetUserName API call. See
http://www.mvps.org/access/api/api0008.htm at "The Access Web" for a
complete sample.
 
Top