Hi Jezmo,
The problem is the size of the string; check the modified code.
 
Hope that helps!
 
Manuel

jezmo_codpiece <[EMAIL PROTECTED]> wrote:
I am trying to get the logged in windows user name to record the
last person to edit a record. I can do this OK using the following:


Function ap_GetUserName() As Variant

Dim strUserName As String
Dim lnglength As Long
Dim lngResult As Long

' set up the buffer
strUserName = String$(255, 0)
lnglength = 255
lngResult = wu_GetUserName(strUserName, lnglength)
If lngResult <> 0 Then
        ap_GetUserName = Left$(strUserName, lngResult - 1)
else

   ap_GetUserName = ""
end if
End Function

But the string seems to be filled with non-usable characters after
the username, as when I try to paste this to a text box it tells me
the string is too long. Does anyone know how to easily get just the
user name without the garbage?
Many thanks in advance.





Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping


Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to