如何在Access vba中获得登录用户的名称? [英] How to get logged-in user's name in Access vba?
本文介绍了如何在Access vba中获得登录用户的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
Is there a way for MS Access to grab the current Active Directory user?
I want to get the name of the logged-in User via vba in access. What is the best way to do this?
该问题的重复项:
- 是MS Access有没有办法抓住当前的Active Directory用户?
- 使用VB6,如何在Windows XP上获取当前用户和域?
- 如何我可以在Access VBA中获得当前登录的Windows用户吗?
- Excel 2007 VBA和WMI-当前DOMAIN \ USER
- Is there a way for MS Access to grab the current Active Directory user?
- Using VB6, how do I get the current user and domain on Windows XP?
- How can I get the currently logged-in windows user in Access VBA?
- Excel 2007 VBA and WMI - Current DOMAIN\USER
推荐答案
Public Declare Function GetUserName Lib "advapi32.dll"
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
....
Dim strLen As Long
Dim strtmp As String * 256
Dim strUserName As String
strLen = 255
GetUserName strtmp, strLen
strUserName = Trim$(TrimNull(strtmp))
Turns out question has been asked before: How can I get the currently logged-in windows user in Access VBA?
这篇关于如何在Access vba中获得登录用户的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文