Making A Call To The API When A User Hits A Button To Retrieve TheCurrent System User Name

R

R Tanner

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'...
 
A

Albert D. Kallal

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.
 

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