Jim Dettman
jimdettman at verizon.net
Sun Mar 15 16:04:27 CDT 2009
Jennifer, You can use the function below. Paste it into a general module with the declares. It will return either the computer name or user name. Jim. Private Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long Public Function WhoAmI(bReturnUserName As Boolean) As String ' Function returns either user name or computer name Dim strName As String * 255 10 If bReturnUserName = True Then 20 GetUserNameA strName, Len(strName) 30 Else 40 GetComputerNameA strName, Len(strName) 50 End If 60 WhoAmI = left$(strName, InStr(strName, vbNullChar) - 1) End Function -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jennifer Gross Sent: Sunday, March 15, 2009 4:31 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Windows Username Happy Sunday, How can I grab the Windows username from inside A2K? The client uses Terminal Server and is currently on Windows Server 2000, but will shortly be upgrading to Windows Server 2003. Thanks, Jennifer -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com