User form not working

CEH

Curtis
Local time
Yesterday, 18:55
Joined
Oct 22, 2004
Messages
1,187
Needed to see the users in a DB..... Tried this code.....only shows me.....Did it on Frontend ...backend.... am I missing something here???

Code:
    Private Sub GenerateUserList()
    'The User List Schema information requires this magic number. For anyone
    'who may be interested, this number is called a GUID or Globally Unique
    'Identifier - sorry for digressing
    Const conUsers = "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
   
    Dim cnn As ADODB.Connection, fld As ADODB.Field, strUser As String
    Dim rst As ADODB.Recordset, intUser As Integer, varValue As Variant
   
   Set cnn = CurrentProject.Connection
   Set rst = cnn.OpenSchema(Schema:=adSchemaProviderSpecific, SchemaID:=conUsers)
  
   'Set List Box Heading
   
  strUser = "Computer;User;Connected?;Suspect?;ID"
   With rst    'fills Recordset (rst) with User List data
     Do Until .EOF
       intUser = intUser + 1
         For Each fld In .Fields
          varValue = fld.Value
            'Some of the return values are Null-Terminated Strings, if
             'so strip them off
            If InStr(varValue, vbNullChar) > 0 Then
              varValue = Left(varValue, InStr(varValue, vbNullChar) - 1)
            End If
            
              strUser = strUser & ";" & varValue
                 Next
      strUser = strUser & ";" & GetUserName()
        .MoveNext
     Loop
   End With
  
   Me!txtTotalNumOfUsers = intUser        'Total # of Users
  
   'Set up List Box Parameters
   Me!lstUsers.ColumnCount = 5
   Me!lstUsers.RowSourceType = "Value List"
   Me!lstUsers.ColumnHeads = False
     lstUsers.RowSource = strUser       'populate the List Box
  
   'Routine cleanup chores
   Set fld = Nothing
   Set rst = Nothing
   Set cnn = Nothing
   End Sub
 

Users who are viewing this thread

Back
Top Bottom