I'm trying to put the results of the UserRoster into a listbox on a form for easy viewing. I've attached a picture of the form and the pertinent code while I'm trying to debug it. The sub is called on load and on a timer every 5 secs. Anyone know why it's not updating all the columns?
I'm wondering what the non-displayable characters are in the string you have generated. I would suggest you use Trim(Nz(rs.Fields(0), "")) for each of the four fields in the rs recordset. The Trim() function should remove that non-displayable characters. It would also be good to know what error message you are receiving (if any).
I had tried the trim function, and it didn't make any change. Oddly enough, it didn't give me any error msgs. But you did give me an idea; so I used asc() to figure out what char was being a pain, then used
Private Sub ShowUsers()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
Dim strItem As String
Set cn = CurrentProject.Connection
Set rs = cn.OpenSchema(adSchemaProviderSpecific, , _
LstBoxUsers.RowSource = ""
strItem = rs.Fields(0).Name & ";" & _
rs.Fields(1).Name & ";" & _
rs.Fields(2).Name & ";" & _
While Not rs.EOF
strItem = Trim(Nz(rs.Fields(0), "NULL")) & ";" & _
Trim(Nz(rs.Fields(1), "NULL")) & ";" & _
Trim(Nz(rs.Fields(2), "NULL")) & ";" & _
strItem = Replace(strItem, Chr(0), "")
Set rs = Nothing
Set cn = Nothing