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
 
J

jordan king

If you want an easy way to access some system variables on the workstation
look at the Environ varaibles avialable to access.

COMPUTERNAME
USERNAME
USERDOMAIN
etc...


I personally capture this data once the project is opened, into hidden
values on a main switchboard, then refrence these when passing parameters to
sql server procedures.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top