Noname > 28-08-10, 11:27 AM
Private Sub cmdClose_Click()
DoCmd.Close
End Sub
Private Sub cmdRefresh_Click()
ListConnections
End Sub
Private Sub Form_Load()
ListConnections
End Sub
Private Sub ListConnections()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strComputerName As String
Set cnn = CurrentProject.Connection
Set rst = cnn.OpenSchema(adSchemaProviderSpecific, , _
"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
lboConnections.RowSource = vbNullString
lboConnections.AddItem "Computer Name;Login Name"
Do While Not rst.EOF
If rst("Connected") Then
strComputerName = rst("Computer_Name")
lboConnections.AddItem Left(strComputerName, _
InStr(strComputerName, vbNullChar) - 1) & ";" & rst("Login_Name")
End If
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set cnn = Nothing
End Sub