Function value does not display in A2007

  • Thread starter Thread starter TAS
  • Start date Start date
T

TAS

For years I have been grabbing the network user ID in A2000 and seting it as
a textbox value. Recently we updated to A2007 and the value has become #Name.

The code we used to capture the NetworkUserID still seems to be able to get
the ID if we stick a message box in the code to check it but the value does
not get pulled into the text box.

The code used to grab the ID is:
Private Declare Function acbGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long



Function acbNetworkUserName() As String
'Returns the network login name.
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = acbGetUserName(strUserName, lngLen)
If lngX <> 0 Then
acbNetworkUserName = Left$(strUserName, lngLen - 1)
Else
acbNetworkUserName = ""
End If

End Function

The control source for the text box is "=[acbNetworkUserName]"

What changed, and how can I get it to work again?
 
TAS said:
For years I have been grabbing the network user ID in A2000 and seting it as
a textbox value. Recently we updated to A2007 and the value has become #Name.

The code we used to capture the NetworkUserID still seems to be able to get
the ID if we stick a message box in the code to check it but the value does
not get pulled into the text box. [snip]

The control source for the text box is "=[acbNetworkUserName]"


I find it difficult to believe that ever worked.

The control source expression should be:
=acbNetworkUserName()
 
That worked. Thank you

Marshall Barton said:
TAS said:
For years I have been grabbing the network user ID in A2000 and seting it as
a textbox value. Recently we updated to A2007 and the value has become #Name.

The code we used to capture the NetworkUserID still seems to be able to get
the ID if we stick a message box in the code to check it but the value does
not get pulled into the text box. [snip]

The control source for the text box is "=[acbNetworkUserName]"


I find it difficult to believe that ever worked.

The control source expression should be:
=acbNetworkUserName()
 
Back
Top