Retreive a Windows UserID First & Last Name

  • Thread starter Thread starter dch3
  • Start date Start date
D

dch3

I'm looking for code that will return the UserId, User First Name and User
Last Name of the person currently logged on to a PC. I've found code that
will supply the UserID, but I also need the person's name. ('dch87' doesn't
tell a person squat.)

David H
 
dch3 said:
I'm looking for code that will return the UserId, User First Name and
User Last Name of the person currently logged on to a PC. I've found
code that will supply the UserID, but I also need the person's name.
('dch87' doesn't tell a person squat.)

David H

I don't know about you, but my PC has no information anywhere about my first
and last name. Now, the network active directory database of the domain I
log into does, but it is not a simple environment variable that you can grab
with an API like the login name is.

While in many cases it is possible to query Active Directory from your app,
I personally just have a table in my database that maps login names to other
information about the user that I want to have handy in my applications.
When I set up a new user I have them provide all of that so it can be
entered into the table. Then I use the login retrieved from the API to get
the rest of that data.
 
Its the Active Directory information that I'm looking for. The idea is to
setup a means by which the user id, user first name and user last name is
preloaded onto a registration form of sorts. The idea is that users will be
entering their information on their own for documentation purposes only. I
can already grab the ID, but was hoping to grab the user first & last name to
speed things up. Due to the nature of the business, things have to be as
absolutely simple as possible.

David H
 
"Dr. Lanning's Hologram: I'm sorry, my responses are limited. You must ask
the right question."

Its the Active Directory user information that I'm looking for and evidently
it is possible via VBA, although I've only started snooping around.

David H
 
Back
Top