gpt4 book ai didi

windows - Access 函数返回用户名,而不是用户名

转载 作者:可可西里 更新时间:2023-11-01 09:20:57 25 4
gpt4 key购买 nike

是否有一个函数可以用来将当前用户名而不是他们的用户名返回到文本框 - 所以是 Joe Bloggs,而不是 jbloggs?

最佳答案

假设您设置了 Active Directory,您可以使用以下代码,摘自 Andrey Artemyev's answer here :

Public Function ADtest() As String
Dim ADSI As Object, UN As Object
Set ADSI = CreateObject("ADSystemInfo")
Set UN = GetObject("LDAP://" & ADSI.UserName)
ADtest = UN.FirstName
ADtest = ADtest & " " & UN.LastName
Set UN = Nothing
Set ADSI = Nothing
End Function

(在此处添加答案以获得更好的可见性,制作了 Community Wiki,因为这不是我真正的答案,而且我不想要功劳)

关于windows - Access 函数返回用户名,而不是用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14753464/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com