Liste des utilisateurs

Liste des utilisateurs connectés

Cette fonction permet d'extraire du fichier de verrouillage .LDB la liste des utilisateurs d'une base de données.

Ceci ne fonctionne qu'à condition que la base ait été sécurisée.
 

Function fListUsers(Optional strPath) As String
    Dim strLine As String * 64
    Dim i As Integer
    Dim F As Integer

    If IsMissing(strPath) Then: strPath = CurrentDb.Name
    strPath = Left(strPath, Len(strPath) - 3) & "ldb"
    'autre methode:
    'strPath = Left(strPath, InStrRev(strPath, ".", -1)) & "ldb"
    If Dir(strPath) <> "" Then
        F = FreeFile
        Open strPath For Random Access Read Shared As #F Len = Len(strLine)

        For i = 1 To LOF(F) / Len(strLine)
            Get #F, i, strLine
            fListUsers = IIf(fListUsers <> "", fListUsers + ";", "") & Left(strLine, InStr(1, strLine, Chr$(0)) - 1)
        Next i

        Close #F
    End If

End Function


Dernière modification : 08/02/2010 01:52
Catégorie : Les mémos - Administration
Page lue 9583 fois