Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Location
    Eastern Pennsylvania, Pennsylvania, USA
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Current User (97 sr2)

    I need to log the current user name when a record is added, deleted, changed. Any ideas from the pros? Thanks in advance, DP

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Current User (97 sr2)

    I have been using the following on NT4, maybe you could too.
    Set up a module with the following:

    Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long

    Public Function GetUserName() As String
    Dim UserName As String * 255
    Call GetUserNameA(UserName, 255)
    GetUserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
    End Function

    Then to user it is simply:
    dim txtUserName as string
    txtUserName = GetUserName

    Hope this is useful,

    Pat

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Location
    Redmond, Washington, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current User (97 sr2)

    If you are running with Access security enabled you can simply user the CurrentUser() function to get who the user is logged in as. If Access security is not enabled then the CurrentUser() function will always return

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •