I am using the following adapted code supplied by Adezii in one of the vba articles.
I know my changes are SO ugly but alas it works! anyway. My issue is that for some reason the code is only showing users within the ldb file created by the front end of the database.
How do I adapt this to point to the backend, a specific one at that.
Code:
Public Sub GenerateUserList()
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
Dim querystring As String
Dim qrysql As String
Dim outputname As String
Dim passiton As String
Dim sqlstringer As String
Dim ticker As Integer
Set cnn = CurrentProject.Connection
Set rst = cnn.OpenSchema(Schema:=adSchemaProviderSpecific, SchemaID:=conUsers)
'Set List Box Heading
strUser = "Computer;UserName;Connected?;Suspect?;Actual Name?"
ticker = 0
With rst 'fills Recordset (rst) with User List data
Do Until .EOF
intUser = intUser + 1
For Each fld In .Fields
varValue = fld.Value
ticker = ticker + 1
If ticker = 5 Then ticker = 1
'Debug.Print ticker
'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
Select Case ticker
Case 1
passiton = varValue
outputname = GetTheirName(passiton)
Case 2
Case 3
Case 4
varValue = varValue & ";" & "'" & outputname & "'"
Case Else
Debug.Print ticker
End Select
strUser = strUser & ";" & varValue
Debug.Print strUser
Next
.MoveNext
Loop
End With
'Set up List Box Parameters
Me!lstUsers.ColumnCount = 5
Me!lstUsers.RowSourceType = "Value List"
Me!lstUsers.ColumnHeads = True
Me!lstUsers.RowSource = strUser 'populate the List Box
'Routine cleanup chores
Set fld = Nothing
Set rst = Nothing
Set cnn = Nothing
End Sub
How do I adapt this to point to the backend, a specific one at that.
Comment