Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box to List Box

Status
Not open for further replies.

sara82

Technical User
May 20, 2005
78
US
NewPicture.bmp

As you can see I have a form which filters reports according to what is input into the form.

I have a combobox: Product Directorate. When the user selects a Product Directorate, the report will run showing the info for that particular Product Directorate.
This all works fine.

I wanted to convert my combo box into a list box so that a user can, for instance, select 2 Product Directorates and the report will run showing the info or these 2.

In form design I right clicked on my combo box, went to Change to, and selected List Box. Then for the properties of the list box for the Multi Select, I chose Simple.

Now when I select multiple Product Directorates and then run the report it doesn't filter like it should It lists all of the Product Directorates in the report. Even if I select only one Product Direcorate, it won't even filter.

Any suggestions?
 
How are ya sara82 . . . . .

When you change MultiSelect to [blue]Simple or Extended[/blue], the standard means of accessing data [blue]no longer works[/blue], as the listbox is now [purple]setup to return a collection of the indexes selected[/purple], even if its only one.

You have to access the data thru the [purple]ItemsSelected[/purple] collection. Look it up in VBE help as your code or your means of filtering has to change to handle Multi-Select.

Calvin.gif
See Ya! . . . . . .
 
Hi, sara82,

Yup, the value of a multi-select listbox is always Null. As AceMan noted, you will have to loop through the listbox's ItemsSelected collection to get the selected values.

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top