R Tanner said:
Hi,
I want to make a call to the API to retrieve the current system login
name for the user logged into a machine. How can I retrieve that name
from the thread in the OS? I'm not sure how I would do that
programmatically...the CurrentUser function only returns 'Admin'...
You can get the current network user 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.
If you want to know who created the record in access, then you can capture
that in the before-insert event:
eg:
me.CreatedBy = fosUserName()
If you want the last person updated the record, then you can caption that in
the before update event of the form, and simply go:
me.LastEditedBy = fosuerName()
Of course the before update event does not fire if the user does not edit
the record, and the same thing goes for the before insert event, it doesn't
fire unless the user actually creates a new record, so this way you can
easily who last edited a record, or even who created the record.