multi column listbox

  • Thread starter Thread starter mpg
  • Start date Start date
M

mpg

access 2003. how do i add items to a listbox with multiple columns? the
syntax in the online manula doesnt cover it.
ie// listbox1 has 3 columns, and i want to use the add-item method to
populate each of the 3 columns for each row.

thank you very much,
mike g
 
The usual way to do this would be to use a 'callback function'. It's a piece
of vba that is called several times, each time with a different parameter.
Based on that parameter, the function should return all list box contents,
most importantly # rows, # columns and contents per row/column.
The 'rowsource' property of the listbox is linked to the name of the
function.

Initialise and close calls can be used to open and close a recordset. If so,
make sure you declare the variables global (i.e. right below the 'Option
explicit' on top of the page), and not as variables limited to the function
itself.

See http://www.mvps.org/access/forms/frm0049.htm for an example, or look for
this in the help files.

Bas Hartkamp.
 
It explains it in the Help file:

For multiple-column lists, use semicolons to delimit the strings for each
column (for example, "1010;red;large" for a three-column list). If the Item
argument contains fewer strings than columns in the control, items will be
added starting with the left-most column. If the Item argument contains more
strings than columns in the control, the extra strings are ignored.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top