List Box Question

  • Thread starter Thread starter Confused
  • Start date Start date
C

Confused

I have a list box on a form that is bound to a text
field. The Multi Select property is set to "Simple" to
allow users to select multiple values.

The problem is that the selected values are failing to
save regardless of whether single or multiple are
selected. Upon further testing I discovered that the data
will not save so long as the Multi Select property is set
to "Simple" (or "Extended").

The problem does *not* happen if Multi Select is set
to "None". Data saves just fine.

How does one save multiple values to the bound field?
 
Your tables are not set up correctly if there is a need to save multiple
values to the same bound field. You have a one-to-many relationship between
the main entity of your table and the multiple values you are trying to
save. You need to add another table to your database for the multiple
values. Your tables should look something like:
TblMainEntity
MainEntityID
etc

TblTextValue
TextValueID
MainEntityID
TextValue

You need a relationship between MainEntityID in both tables.

You then need a form/subform for data entry. The LinkMaster/LinkChild
properties would be set to
MainEntityID. You would enter the Main Entity in the main form and the list
of values(your multiple values) in the subform.
 
Thanks for the response.

Does the below mean that multiple values cannot be saved
to the same text field?

Also, just to be clear, is "TblMainEntity" the record
source for the list box and "TblTextValue" the table where
the multiple values will be stored? I don't understand
how the mutliple values are getting from the list box to
the bound field.
 
See My Comments inside your post below ----

Confused said:
Thanks for the response.

Does the below mean that multiple values cannot be saved
to the same text field?

*** You can't save individual multiple values; you need to store them as a
delimited string. The usual delimiter is a comma.
example: Text1, Text2, Text3, Text4
This takes code to create the string***
Also, just to be clear, is "TblMainEntity" the record
source for the list box and "TblTextValue" the table where
the multiple values will be stored?

*** No, not at all. Say you had a database of books and you wanted to
associate keywords with each book so you could search the database by
keywords to find certain types of books. The main entity is Book. You would
enter data about each book in TblBook (TblMainEntity) via the main form.
Each book would be a record. The values would be the keywords. You would
enter the list of keywords in the subform associated with each book. Each
keyword would be a record in TblKeyword (TblTextValue). If you had a long
list of keywords that contained all the keywords for all the books, you
could put them in a table and enter them into the subform with a combobox or
listbox. They would have to be entered one at a time because each keyword is
a record. Your trying to use a multiselect listbox is just not applicable
here!***


I don't understand
 
Thanks for the info.

-----Original Message-----
See My Comments inside your post below ----



*** You can't save individual multiple values; you need to store them as a
delimited string. The usual delimiter is a comma.
example: Text1, Text2, Text3, Text4
This takes code to create the string***


*** No, not at all. Say you had a database of books and you wanted to
associate keywords with each book so you could search the database by
keywords to find certain types of books. The main entity is Book. You would
enter data about each book in TblBook (TblMainEntity) via the main form.
Each book would be a record. The values would be the keywords. You would
enter the list of keywords in the subform associated with each book. Each
keyword would be a record in TblKeyword (TblTextValue). If you had a long
list of keywords that contained all the keywords for all the books, you
could put them in a table and enter them into the subform with a combobox or
listbox. They would have to be entered one at a time because each keyword is
a record. Your trying to use a multiselect listbox is just not applicable
here!***


I don't understand


.
 
Back
Top