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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiselect list box not writing any values to table at all

Status
Not open for further replies.

NeedsHelp101

Technical User
Jul 18, 2006
43
US
Hello,

I'm working on a form-subform combination, where the main form is a date, and the subform is a list of events. Both are supposed to write to the same table.
When the subform is a list box where only one value can be selected, everything works.
However, I need the subform to be an extended multiselect list box, so that I can type in a date in the main form, select several events for that day, then continue onto another day.
But, when I make the subform an extended multiselect, no values whatsoever are written to the table.

Any suggestions?
 
Have a look at ItemsSelected

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi, NeedsHelp101,

The value of a multi-select listbox is always [blue]Null[/blue]. As PHV suggests, you must loop through the ItemsSelected collection and write the values to the table/recordset as you go.

Ken S.
 
I'm sorry, I'm very new at this, but where do I find the ItemsSelected option? I don't see it in the properties box.

I'm also assuming that I will have to code this loop, and put it in a module, correct?

Thank you!
 
I'm not sure if this will work for you but it has for me. I use this to write the selected items to a table.

For Each varItem In Me.lstTub.ItemsSelected
.Fields("lstToilets") = Me.lstTub.Column(0, varItem)
.Update
Next varItem

You will declare the varItem and then on the save button or click event have this code for the listboxes that are multiselect. The Next varItem is if you have several listboxes like mine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top