Stuart McLachlan
stuart at lexacorp.com.pg
Wed Sep 1 07:35:01 CDT 2004
On 1 Sep 2004 at 8:18, Nicholson, Karen wrote: > It is great to be back on the list and working with Access again. It > has been a while. I am looking for the user defined function to grab > the network user name or id. I have inherited an Access 2002/SQL 2000 > back-end database run completely by macros with a pretty bad password > scenario. This should keep me busy for a while. > Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function UserName() As String Dim strUName As String Dim lngResponse As Long UNAME = Space$(32) lngResponse = GetUserName(strUName, 32) strUName = Trim$(strUName) UserName = Left$(strUName, Len(strUName) - 1) 'strip Chr$(0) from end of name End Function -- Stuart