Good morning to everybody. I’m working around this matter. Hereinafter my code. Problem consisting in the listbox Elenco5 on Form UTEEDB having 3 column. Now I would like to split data in each column but code show only the first one. Target was to have list of database users and drop the ones choosed by double click on listbox. Can someone give me suggestions? Thank you in advance.
Public Sub UtentiConnessi()
'ACCESS2007 desktop remoto SERVER2008 database.accbd
'funzione che uso per sapere quali sono gli utenti loggati
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rowIndex As Integer
Set cn = CurrentProject.Connection
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4.0 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}")
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name
' Output dell'elenco di tutti gli utenti nel database corrente
While Not rs.EOF
On Error Resume Next
'Ottieni l'indice della nuova riga
rowIndex = Me.Elenco5.ListCount
MsgBox rowIndex
Me.Elenco5.AddItem "'" & (rs.Fields(0).Value) & "'" & ";" & "'" & (rs.Fields(1).Value) & "'", rowIndex
If Err.Number <> 0 Then
MsgBox "Errore nell'assegnazione del valore: " & Err.Description
End If
On Error GoTo 0
rs.MoveNext
Wend
' Chiudi il recordset e la connessione
rs.Close
cn.Close
End Sub