title: VB code for capturing user from Windows, to be used in Access (Ver. 2020 64 bit)
body: <p>I created an application in Access 2016 32 Bit, which in several update queries, log the user, by capturing it from Windows. We are now migrating to Windows 10 64 bit, and the code is not compatible. This is the code I have: </p>
  
  <pre><code>Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal IpBuffer As 
  String, nSize As Long) As Long
  Function fOSUserName() As String
  'Returns the network login name'
  Dim IngLen As Long, IngX As Long
  Dim strUserName As String
  strUserName = String$(254, 0)
  IngLen = 255
  IngX = apiGetUserName(strUserName, IngLen)
  If (IngX &gt; 0) Then
      fOSUserName = Left$(strUserName, IngLen - 1)
  Else
      fOSUserName = vbNullString
  End If
  
  End Function
  </code></pre>
  
  <p>Can someone give me a hand for a similar solution that works in 64 bit? </p>
  
  <p>Thank you. </p>