Multi-select listbox output to text box?!?!?

G

Guest

Multi-select listbox output to text box?!?!?
(A bump of sorts)

Good day,
I have a rather frustrating problem I need with. Basically, I require the following on a form:

A multi-select list box. (data comes from a table)
Display of selected items in a separate text box. (Either automatically, through dbl click - whatever)
Said choices in the text box, bound to a record table.

I have code which sends the selected items to another list box, but that seems to preclude the items from being stored as a record.

Any help?
 
D

Douglas J. Steele

Since it violates database normalization principles to store more than one
value in a single field, it's not possible to bind a multi-select listbox to
a text box.

If you're determined to do this, the code in
http://www.mvps.org/access/forms/frm0007.htm at "The Access Web" shows you
how to loop through a multi-select list box, getting details of each
selected item. You should be able to modify that code to populate a text
box.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Joel said:
Multi-select listbox output to text box?!?!?
(A bump of sorts)

Good day,
I have a rather frustrating problem I need with. Basically, I require the following on a form:

A multi-select list box. (data comes from a table)
Display of selected items in a separate text box. (Either automatically, through dbl click - whatever)
Said choices in the text box, bound to a record table.

I have code which sends the selected items to another list box, but that
seems to preclude the items from being stored as a record.
 
J

Joel

Firstly, thanks for your prompt reply. Pls allow me to
throw this at you: How about instead of a text box for
output, a combo box? Here's why I ask:

The original form had the output sent to another listbox,
and the only problem was the output data wasn't being
recorded in a table. So I changed it to a text box, no
luck. But when I changed it to a combo box, instead of the
text being displayed, the numerical value from another
column in the table was being displayed. This was probably
because the form has a third text box which displayed a
tally of numerical values assigned to each text choice.
Anyway, it was displaying the numbers, individually and
recording them into a table, just as I'd need the text to,
only I couldn't get it to display the text. I even changed
the columns around - no luck. Does this make any sense? I
got the code to make these things happen on these boards,
so I'm not familiar with what all that code really means.
Any ideas?

JP
 
D

Douglas J. Steele

It's not possible to store multiple values in a single field, and then hope
to display them properly..

If you add code to the list box's AfterUpdate event to populate the text
box, you'll be able to get something that populates a text box, but it's
really not a good idea.

You really should consider normalizing your data. Once you get over the
initial hurdle, you'll find it's much simpler to deal with the multiple
values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top