I have a list box on a form. The list box is bound to a field of a table. When I select a single or multiple items from the list, the selected items will not be recorded in the table. Can somebody help me to fix this problem?
I have a list box on a form. The list box is bound to a field of a table. When I select a single or multiple items from the list, the selected items will not be recorded in the table.
If you can select multiple items from the Listbox, you have its MultiSelect Property set to something other than None. When this Property is set to Simple or Extended, the Listbox loses its Value Property, and my guess is that it cannot actually be Bound to a Field in the underlying Table. When set to Simple or Extended, you have to loop through the Listbox to determine what selection(s) have been made and then assign these to whatever.
With a plain language explanation of exactly what you're trying to do, here, we might be able to advise you on how to do it.
Yes, you are right. The Multi Select property has been changed to Simple to be able to choose multi items. Well, I have days of the week in the list box, and I want to be able to select multi days. can you possibly let me know how I can write the code to read the items from the list and store the selected items in a field of a table either.
You'll need to assign the selections, separated by something (usually a comma or semi-colon) to a Bound Control on your Form. Here’s an excellent example of extracting data from Multi-Select Listboxes:
Thanks for the example. Can you possibly tell me how I can add the string to the underlying table. / I also want to know how you can add an item like "All" in the list box in your example to be able to show all the items in the report. I have a similar example in my database, but I filter my report by sending the values from a combo box to a criterion of the query underlying the report. In my list box, I put "*" value to be able to select all the items. But I thought maybe your way of filtering the report would be safer/smarter.