Nancy Lytle
nancy.lytle at auatac.com
Wed Oct 29 09:42:02 CST 2003
Thanks for the reply, Lambert, The problem comes up when the MainMenu is opened or "current" in the following code are: Private Sub Form_Current() Call fcnOSUserName >>>> this is where it stops, and it never had any problem before. ...code to show certain controls depending on the user.... End sub Note: fcnOSUserName is set out in a module containing the startup function like relinking, setting user group, etc. Access crashed just a bit ago (for a different reason) and it gave the "sorry for the inconvenience message" then did a repair and restart and the problem is gone - even though I had done a compact and repair. I guess maybe I should have tried a decompile, recompile too. So, I don't know what caused it, but to be safe I think I will create a new db and import everything into it, a piece at a time. Thanks, Nancy Lytle EIS nancy.lytle at auatac.com 202-314-1393 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Wednesday, October 29, 2003 10:27 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Out of stack space Nancy, How is the API call declared? It should look like this... Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Which line generates the Out Of Stack Space error? What is the value being returned in lngLen? Does it make sense, like "9", or is it some ridiculous value? Lambert > -----Original Message----- > From: Nancy Lytle [SMTP:nancy.lytle at auatac.com] > Sent: Wednesday, October 29, 2003 9:58 AM > To: Accessd > Subject: [AccessD] Out of stack space > > 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 _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com