Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007

    Unanswered: AppUser by Dev Ashish

    Hi Everyone,

    Does anyone knows how to use the form? I take a look on the codes for the form.

    I am not sure what are the 4 types of option button in the form used for?? I am not sure about the suspect state used for??
    Hmm.. But i like the application as it can detect the Machine Name and number of users.

    However, I need to detect the network name of the user and name of person.
    Can anyone help me on these?

    I have written some codes and the network name and name of the person do not work well as it reflect my name and network name instead of the current user using the accesss application..

    The detection of the machine name is ok but not for the network name and username.

    Private Sub sUseUserRoster()
    ' Modified version of code found in the following KB Article
    ' Q198755 -
    ' ACC2000: Checking Who Logged into Database with Jet UserRoster
    On Error GoTo ErrHandler
    Dim cn As Object
    Dim rs As Object
    Dim i As Integer
    Const adSchemaProviderSpecific = -1

    Set cn = CreateObject("ADODB.Connection")
    Set rs = CreateObject("ADODB.Recordset")

    cn.Provider = "Microsoft.Jet.OLEDB.4.0"
    cn.Open "Data Source=" & Me.txtDBPath

    ' The user roster is exposed as a provider-specific schema rowset
    ' in the Jet 4 OLE DB provider. You have to use a GUID to
    ' reference the schema, as provider-specific schemas are not
    ' listed in ADO's type library for schema rowsets

    Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
    , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

    m_tLDBInfo.strErrorMsg = vbNullString

    With m_tLDBInfo
    If rs.EOF Then
    Do While Not rs.EOF
    ReDim Preserve .atLUI(i)
    .atLUI(i).strMachineName = rs(0)
    .atLUI(i).strUserName = WindowsUserName()
    .atLUI(i).strLoginName = fGetFullNameOfLoggedUser()

    .atLUI(i).blnConnected = rs(2)
    .atLUI(i).varSuspectState = rs(3)
    .intUserCount = i
    i = i + 1
    End If
    Me.lblUserCount.Caption = .intUserCount
    End With

    On Error Resume Next
    Set rs = Nothing
    Set cn = Nothing
    Exit Sub
    With Err
    MsgBox "Error: " & .Number & vbCrLf & .Description, _
    vbCritical Or vbOKOnly, .Source
    End With
    Resume ExitHere
    End Sub

    Private Sub sDisplayUsers()
    Dim varBuffer As Variant
    Dim intReturn As Integer
    Dim i As Integer, j As Integer

    With Me
    intReturn = GetComputerNames(.txtDBPath, .optDisplayOptions, varBuffer)
    If IsArray(varBuffer) Then
    Erase m_tLDBInfo.atLUI
    m_tLDBInfo.intUserCount = intReturn
    m_tLDBInfo.strErrorMsg = vbNullString
    For i = LBound(varBuffer) To UBound(varBuffer)
    If (Len(varBuffer(i))) Then
    ReDim Preserve m_tLDBInfo.atLUI(j)
    With m_tLDBInfo.atLUI(j)
    .strMachineName = varBuffer(i)
    .strUserName = fGetRemoteLoggedUserID(.strMachineName)
    End With
    j = j + 1
    End If
    With m_tLDBInfo
    .strErrorMsg = LDBUser_GetError(intReturn)
    .intUserCount = 0
    End With
    End If
    .lblUserCount.Caption = m_tLDBInfo.intUserCount
    End With
    End Sub

  2. #2
    Join Date
    Jan 2007
    Provided Answers: 10
    I suggst you take a look at this post by pkstormy.
    Home | Blog

  3. #3
    Join Date
    May 2007

    AppUser by Dev Ashish

    Hi georgev,

    I want to detect the machine name and network name of the user using the access application by another access form because sometime the user do not close the application after finish using it. So that with the form create by Dev Ashish, I can tell who are using the form and the current user.


Posting Permissions

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