question

DavidHaycraft-2009 avatar image
0 Votes"
DavidHaycraft-2009 asked TvanStiphout answered

How to retrieve current signed-in user name of Access 2019 app

In a Windows 10/Access 2019 app, using VBA code, I need to retrieve the name of the current signed-in user .


The name I'm seeking is automatically displayed in the top row of the Access app’s main window. See attached screenshot.

Sadly, both Environ("Username") and CreateObject("WScript.Network").UserName just return the string value “user”.

104517-fig1.png

How can I retrieve the actual signed-in user name of my Access 2019 app?


office-vba-dev
fig1.png (29.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

TvanStiphout avatar image
0 Votes"
TvanStiphout answered

I think that is not easy to do. Why is it important?

It is easy to get the user as far as Access is concerned (almost always: "Admin") or as far as Windows is concerned (the username you signed on to Windows with (see https://www.devhut.net/2018/04/12/vba-recognize-user-get-username/ and others)), but the pretty name that Access is displaying is not easy.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.