Here are two fucntions, one to get all environment variables and another to just get the login ID. I got this from someone off of here so I take no credit.
-------------begin code-------
Option Compare Database
Option Explicit
Private Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" _
(ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
Public Function GetUserLoginName(Optional StripNullTerminator As Boolean = True) As String
Dim strName As String
Dim strResult As String
strName = Space(255)
Call WNetGetUser("", strName, Len(strName))
strResult = Trim$(strName)
'Not sure we want this - should this be optional true or false
If StripNullTerminator Then
If Asc(Right$(strResult, 1)) = 0 Then
strResult = Left$(strResult, Len(strResult) - 1)
End If
End If
GetUserLoginName = strResult
End Function 'GetUserLoginName
Public Function GetEnvironmentSettings() As Variant
Dim strEnviron As String
Dim lngIndex As Long
Dim strMessage As String
Dim lngPathLength As Long
Dim avarEnviron As Variant
Dim varValue As Integer
Dim reference As String
lngIndex = 1
ReDim avarEnviron(1, lngIndex)
Do Until Len(Environ$(lngIndex)) = 0
strEnviron = Environ$(lngIndex) 'Get environment variables
ReDim Preserve avarEnviron(1, lngIndex)
avarEnviron(0, lngIndex) = Left$(strEnviron, InStr(strEnviron, "="

- 1)
avarEnviron(1, lngIndex) = Mid$(strEnviron, InStr(strEnviron, "="

+ 1)
' MsgBox "Environ$(" & lngIndex & "

: " & strEnviron
If Left$(strEnviron, 5) = "PATH=" Then
lngPathLength = Len(Environ$("PATH"

) ' Get length.
strMessage = "PATH entry = " & lngIndex & " and length = " & lngPathLength
' Exit Do
End If
lngIndex = lngIndex + 1
Loop
strEnviron = ListEnvironmentArray(avarEnviron)
MsgBox "Environment variables for this PC:" & vbCrLf & vbCrLf & strEnviron
GetEnvironmentSettings = reference
End Function 'GetEnvironmentSettings
Private Function ListEnvironmentArray(ByRef ravarEnviron As Variant) As String
Dim ialng As Long
Dim str As String
For ialng = 1 To UBound(ravarEnviron, 2) 'Skip 0 because will always be empty
str = str & ravarEnviron(0, ialng) & ": " & ravarEnviron(1, ialng) & vbCrLf
Next ialng
ListEnvironmentArray = str
End Function
----------end code--------