Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Posts
    3

    Unanswered: List of Current Network Users Accessing Database

    Anyone know how (or if it's possible) to generate a list Windows network user names (not MS Access User Names from Security module) that are currently logged into a multi-user shared database?

    I got a function from the MS website to get the current user at the current machine, but I'm looking to find out the remote users accessing the database.

    Any ideas?

    Thanks,

    Rick

  2. #2
    Join Date
    Jun 2002
    Location
    Central New Jersey
    Posts
    69
    I got this from http://www.mvps.org/access. It's a great web site.


    Paste the following code in a new module and call the function fOSUserName.


    '******************** Code Start **************************
    Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

    Function fOSUserName() As String
    ' Returns the network login name
    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
    fOSUserName = Left$(strUserName, lngLen - 1)
    Else
    fOSUserName = ""
    End If
    End Function
    '******************** Code End **************************

    Good luck.
    Last edited by jdegeorge; 06-05-02 at 11:55.
    "There's never enough time to do it right, but there's always enough time to do it over!"

Posting Permissions

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