[AccessD] Out of stack space

Bryan Carbonnell Bryan_Carbonnell at cbc.ca
Wed Oct 29 09:34:06 CST 2003


I *think* the problem is that you are create a string with a length of
254 characters

strUserName = String$(254, 0)

and then telling the API that the buffer is 255 characters

lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)

Either change lngLen to 254 or make strUserName 255 characters.

Bryan Carbonnell
bryan_carbonnell at cbc.ca


>>> nancy.lytle at auatac.com 29-Oct-03 9:58:04 AM >>>
I just got Windows XP and Office XP loaded at work.  Now when I call
my
function to grab the user name I get an "out of stack space" error.
 
>>>>>>>>>>>>>>>>>>>>>>
Here is the function code:
Public Function fcnOSUserName() As String
On Error GoTo Err_fcnOSUserName

    'Returns the network login name from the Operating System
    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
            fcnOSUserName = Left$(strUserName, lngLen - 1)
        Else
            fcnOSUserName = vbNullString
        End If
Exit_fcnOSUserName:
Exit Function

Err_fcnOSUserName:

Call LogError(Err.Number, Err.Description, "fcnOSUserName()")
    Resume Exit_fcnOSUserName
End Function
>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
It still logs in the user name to my userlog table but I'd like to get
rid
of the error since it stops the program and asks if you want to end or
debug.  My users would freak out if they saw this.
 
Anyone know what's going on?
 
Nancy Lytle
EIS
nancy.lytle at auatac.com 
202-314-1393
 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list