H
Hilo Hatties
I want to get the enduser network login name and have code
that does it as long as they are using Access 2000. But
it doesn't work for Access 2002. Access 2002 gives an
error message, "Requested type library or wizard is not a
VBA project." Can I tweak my existing code to handle both
versions of Access? Any help would be appreciated. Here
is the existing code:
Option Compare Database
Option Explicit
Private Declare Function apiGetUserName Lib "advapi32.dll"
Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As
Long) As Long
Function fOSUserName() As String
'get the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
that does it as long as they are using Access 2000. But
it doesn't work for Access 2002. Access 2002 gives an
error message, "Requested type library or wizard is not a
VBA project." Can I tweak my existing code to handle both
versions of Access? Any help would be appreciated. Here
is the existing code:
Option Compare Database
Option Explicit
Private Declare Function apiGetUserName Lib "advapi32.dll"
Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As
Long) As Long
Function fOSUserName() As String
'get the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function