Hi. I also avoid using Environ() and prefer using this instead.Old thread, but why not use... (I haven't looked into the newer solution):
Ok, but these sometimes get old (as seen here), and are much harder to use:
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetComputerName Lib "Kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
So why not use the built in functions already in Access instead?
strUser = Environ("UserName")
I think they newer will expire, since they are MS-peoples concern/problem.
GetUserName = CreateObject("WScript.Network").UserName
GetComputerName = CreateObject("WScript.Network").ComputerName