i've got this simple code behind a command button, in debug.print I get complete data, but when I assign that data to a msgbox... it truncates to the first record only
Does anyone see something that I'm not seeing ?
(with thanks in advance,m.)
Code:
Sub ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
strtext = ""
Set cn = CurrentProject.Connection
Dim dbs As Database, tbl As TableDef, fld
Set dbs = CurrentDb
Set tbl = dbs.CreateTableDef("Users")
Set fld = tbl.CreateField("User", dbText)
' 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
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
strtext = Trim(strtext) _
& ", " & rs.Fields(0)
rs.MoveNext
Wend
strtext = IIf(Len(Nz(strtext, "")) = 0, "no other users connected", strtext)
Response = MsgBox(strtext, vbOKOnly + vbInformation, "Current Connections to MDb")
End Sub