Try this - a ONE LINER : MsgBox Environ("username")
no long function from a DLL to declare - I just checked it in my Access XP and it works there. HTH! Alienwebmaster --- In AccessDevelopers@yahoogroups.com, "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) > > ap_GetUserName = strUserName > > 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. > Please zip all files prior to uploading to Files section. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessDevelopers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/