Finding the Current Username AND Firstname and Lastname

R

rich

Hi All,

Previous question on how to get the username of the currently logged on user
says try this, which works perfectly.

http://mvps.org/access/api/api0008.htm

However, this returns the actual name. Can anyone offer a solution on
modifying the code so that it also gets the users First Name and Last Name.
I am making a form that uses this function but I also need the first name and
last name.

TIA,

Rich
 
A

Al Campagna

Rich,
I haven't used this function, but I gather that it returns something
like "Mary Smith" as fOSUserName.
If so... AND all your UserNames involve just a...
FirstName - a space - LastName
then you should be able to break those values out.

FirstName = Left(fOSUserName,InStr(fOSUserName, " ")-1
LastName = Mid(fOSUserName,InStr(fOSUserName, " ")+1
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
L

Larry Linson

I can't recall a time, ever, that my network login user name was my first
and last name, so it puzzles me how one would extract that information.
Also, just offhand, I am not aware of any requirement nor convention
requiring a network login username to be registered with an actual first and
last name.

Larry Linson
Microsoft Office Access MVP
 
D

David W. Fenton

As you say, it's not mandatory to provide first and last names
when creating an ID, but if they were supplied, you should be able
to get them using the code in
http://www.mvps.org/access/api/api0066.htm at "The Access Web"

It will, of course, be dependent on what the sysadmin who created
the NT user account put into the record. If they didn't fill out the
Full Name field, you'll get the username instead, if I'm remembering
correctly. That is, if I add dfenton and don't fill out Full Name,
dfenton will be returned when you request it (or maybe the username
is written to the Full Name field if nothing else is filled in).
 
A

a a r o n . k e m p f

this information is stored in Active Directory.

Jet doesn't support Active Directory
if you care enough to build a database-- use a database with a
future-- like SQL Server for example

Jet is too buggy to use in the real world, sorry, but you got suckered
into a crap database platform!
 
D

Douglas J. Steele

David W. Fenton said:
It will, of course, be dependent on what the sysadmin who created
the NT user account put into the record. If they didn't fill out the
Full Name field, you'll get the username instead, if I'm remembering
correctly. That is, if I add dfenton and don't fill out Full Name,
dfenton will be returned when you request it (or maybe the username
is written to the Full Name field if nothing else is filled in).

That's why I said "if they were supplied"
 

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