Capture UserName with UserID?

WinDancer

Registered User.
Local time
Today, 14:28
Joined
Oct 29, 2004
Messages
290
I found and used a thread here to capture the UserID that works perfectly.

Is there a way to capture the user's name?

Thanks,
Dave
 
The Environ function is the way to go. For a quick test try these...

MsgBox Environ("UserDomain")
MsgBox Environ("UserName")
MsgBox Environ("ComputerName")

Check out this thread for a function that will list all Environ variables your computers operating system will provide... Get Current User Name and Computer Name
 
I already have all those, and they work fine.

My UserID is EVAE235. That works fine.

My Name is Dave Evans. This is what I am after.

Is there a way to pick this up like the other info?

Thanks again,
Dave
 
You can grab the users full name [First Last] using the API at Dev's site. It works as posted. For a quick test just add this function to the module.

Code:
Function TestGetFullNameOfLoggedUser()
    MsgBox fGetFullNameOfLoggedUser
    'MsgBox fGetFullNameOfLoggedUser(Environ("UserName")) 'either should work
End Function

Here is the link to the API... API: Get full name of the user currently logged in to the system

Just copy the entire page of code into a new module and add the function I listed above to test it.
 
Last edited:
does this work with access 97?

just tried it and gives a blank message box?
 

Users who are viewing this thread

Back
Top Bottom