How to get windows username in MS Access VBA on Windows Server 2008

匆匆过客 提交于 2019-12-02 08:55:57
Andre

I don't know which method you are using (there are several answers), but this one suggested by HansUp is easy and hopefully works on the Server too:

https://stackoverflow.com/a/32565953/3820271

Public Function GetUserName() As String
    ' GetUserName = Environ("USERNAME")
    ' Better method, see comment by HansUp
    GetUserName = CreateObject("WScript.Network").UserName
End Function
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!