Multicolumn listbox only showing 1 column of data

jaccessable

Registered User.
Local time
Yesterday, 16:07
Joined
Feb 12, 2016
Messages
13
I am trying to populate a multicolumn listbox with listbox.additem and cannot see my data in the other columns.

So, I know your first thought - separate the items by semicolon inside of a single string, make sure the column count is more than 1, choose value list, ensure the columns are wide enough - However, I've done all that and it's still not showing data in any other column besides #1.

My command lines are:
sLine = Trim(rs.Fields(0)) & ";" & Trim(rs.Fields(1)) & ";" & Trim(rs.Fields(2)) & ";" & Trim(rs.Fields(3))
me.listbox.additem sLine

A debug.print view of sLine returns: CITY-02332 ;Admin ;True;
Only CITY-02332 shows up. When I load a dummy line of text like "Item 1;Item 2; Item 3;Item 4" it works perfect - all 4 columns have data.

I've done this so many times I can't count them all - years! And now, I'm just at a complete loss. I've got other listboxes in my forms and have no problems with this? Any ideas?
 
It should work - create a new listbox, see if it helps.
 
have you set the Column Widths:1";1";1";1"
 
Both suggestions above were done prior to the post without success. But, I found the issue.

I was curious as to why there were 2 blank spaces in the string CITY-02332 ;Admin ;True; ("2 ;" and "n ;") even after using the TRIM() command and it turns out they were null characters - ASC(0). I looped through the string with debug.print to display the ASC values of each character and a 0 showed up where the blanks were instead of a 32(space). So, I removed the Null character using a REPLACE() command and that finally worked - Trim(Replace(rs.Fields(0), Chr(0), "")). The listbox populates correctly.

Essentially, any character following a Null value will not load into a multicolumn listbox.
 
Ah, that must indicate that the string internal paradigm for your situation is based on the old C-language ASCIZ (zero-delimited ASCII) style - where instead of <CR> or <LF>, the <NUL> is the end of an arbitrary string.

If that is true, then the characters following a <NUL> are invisible because the string ended at the <NUL>. I have no idea what Access thinks about the remainder of that string (following the <NUL>).
 

Users who are viewing this thread

Back
Top Bottom