Using MultiSelect Listbox

bogglebeats

Registered User.
Local time
Today, 08:26
Joined
Dec 19, 2002
Messages
53
Hello. I am having trouble using a multiselect textbox. Initially, i was using a regular combo box to capture information for clients. In the combobox, only 1 value could be selected from the list. I currently have 40 clients that have only one value recorded for the 'business type' field.

Now i have changed the combobox to a listbox and selected 'extended' value for the multiselect property.

1) when i select 1 or multiple values for any records, no values get saved to the tables. values only get recorded when 'none' is selected for the multiselect value for the listbox.

2) for the previous 40 records that have existed, i cannot see any values selected for the records in the forms, but they are recorded in the tables. how would i get them to display in the forms?

is there any code that needs to be implemented to organzine the data or specify any kind of itemsSelected collection? Please let me know what i need to do to use a multiselect listbox. thanks

ameen
 
bogglebeats, as you perhaps suspected, a multiselect listbox is almost a totally different animal than a "normal" single-select listbox.

To explain and answer your questions:

(1) First, they can be set to be bound controls, but they won't store anything relevant in the source table. A listbox with it's multiselect property set to simple or extended has no value and therefore is equal to Null, that means nothing gets stored in the field. To properly store anything in your table, you'll probably need to change your table structure. And you're right about having to reference the .ItemsSelected property of the listbox to get at the items you've selected. Check out this post for more info and code examples: Multi Select List Box --> Query

(2) if this is a bound field, then it's simple if the listbox is single-select. If it's multiselect, it's a bit tougher, but not crazy. Use a query that pulls the results you want, and use it as the rowsource for the listbox.

By the way, a "bound" control on a form is one that has as it's controlsource a field from the form's underlying table or query.
 

Users who are viewing this thread

Back
Top Bottom