Answered by:
How to access the User Name property from the Access Options|General| UserName window

Question
-
Fellow developers,
Have a need to display user name like many of us do. But, when we user Env(username) or Username or any other Windows method, we get a number becuase our user name is a number. But, in the Access Options|General|UserName textbox, we DO see a user name. I want to access that property for displaying. Does anyone know how to access that value from Access.
Again, we have tried:Envir(username) returns a number
Application username does not exist like it does in Excel
currentuser returns a number.
Thanks,
MG
Tuesday, July 26, 2016 5:43 PM
Answers
-
Unfortunately, there is no (documented) way to retrieve the user's name or initials as set in the Access Options dialog.
Regards, Hans Vogelaar (http://www.eileenslounge.com)
- Proposed as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Wednesday, July 27, 2016 6:03 AM
- Marked as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, August 1, 2016 5:29 AM
Tuesday, July 26, 2016 6:03 PM -
(in the Immediate window)
?Environ("username")
TvanStiphoutThis should not return a number, unless you are a number :-)
There is no documented way to get the username from the Options form. Some options can be retrieved using GetOption, but this is not one of them.
-Tom. Microsoft Access MVP
- Proposed as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Wednesday, July 27, 2016 6:03 AM
- Marked as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, August 1, 2016 5:29 AM
Tuesday, July 26, 2016 6:07 PM -
thanks Hans. That is what we thought. We tried everything else. MG
- Marked as answer by mg30 Tuesday, July 26, 2016 8:24 PM
Tuesday, July 26, 2016 8:24 PM -
Hi MG,
The username in the Options box is applicable to the entire Office application, not just Access. I found my Office 2010 username settings in the registry at Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo
In any case, it might not be a reliable information to use anyway because the user can easily change it.
Just my 2 cents...
- Proposed as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Wednesday, July 27, 2016 6:03 AM
- Marked as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, August 1, 2016 5:30 AM
Tuesday, July 26, 2016 9:16 PM
All replies
-
Unfortunately, there is no (documented) way to retrieve the user's name or initials as set in the Access Options dialog.
Regards, Hans Vogelaar (http://www.eileenslounge.com)
- Proposed as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Wednesday, July 27, 2016 6:03 AM
- Marked as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, August 1, 2016 5:29 AM
Tuesday, July 26, 2016 6:03 PM -
(in the Immediate window)
?Environ("username")
TvanStiphoutThis should not return a number, unless you are a number :-)
There is no documented way to get the username from the Options form. Some options can be retrieved using GetOption, but this is not one of them.
-Tom. Microsoft Access MVP
- Proposed as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Wednesday, July 27, 2016 6:03 AM
- Marked as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, August 1, 2016 5:29 AM
Tuesday, July 26, 2016 6:07 PM -
thanks Hans. That is what we thought. We tried everything else. MG
- Marked as answer by mg30 Tuesday, July 26, 2016 8:24 PM
Tuesday, July 26, 2016 8:24 PM -
Thanks Tom.
We tried that and it does return a number because we are a number. We were trying to pull the name from the options panel. Thanks for your help anyway.
MG
Tuesday, July 26, 2016 8:25 PM -
Hi MG,
The username in the Options box is applicable to the entire Office application, not just Access. I found my Office 2010 username settings in the registry at Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo
In any case, it might not be a reliable information to use anyway because the user can easily change it.
Just my 2 cents...
- Proposed as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Wednesday, July 27, 2016 6:03 AM
- Marked as answer by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, August 1, 2016 5:30 AM
Tuesday, July 26, 2016 9:16 PM -
Thx dbguyWednesday, July 27, 2016 12:08 PM
-
Thanks to everyone for their info.
MG
Monday, August 1, 2016 10:37 AM