View Full Version : combo box selections


angelac
07-17-2001, 08:34 AM
How can I display multiple selections from a combo box in a text box on the same form?

Right now the user has the ability to enter customers disabilities in a text box. They want to be able to select these from a combo box. I've added two new tables to the database to hold and link the various disabilities and I've added the combo box to the form.
The users still want the nearly 600 records they have to display as before with the disabilities in the text box. I've decided to make the new combo box invisable until the user decides to add a new record and then let them select the disabilities at this time. It would be great if these would then display in the disability text box.

Does this make sense to anyone?

chrismcbride
07-17-2001, 09:02 AM
angelac

If you just want to store text descriptions of the various disabilities in a string that is stored in one field of the db table, then you should easily be able to do this. I would use the click or double click (which might be better). In the event you would put a bit of code...

Me.txtDisabilities = Me.txtDisabilities & "; " & me.cboDisabilities

The currently selected value in the combo box will be referenced by Me.cboDisabilities.

HTH
Chris

angelac
07-19-2001, 07:16 AM
That code was just what I needed. I was using code like it but was getting errors due to improper syntax. Thank you so much.

Pat Hartman
07-19-2001, 05:27 PM
If you ever expect to do anything with this data, DON'T store it all glomped together in a single field. You have a 1-to-many relationship. The disablilities need to be stored in a separate table so that as many as necessary can be related to the same person. You will need a subform to maintain this information.

Your best bet is to "convert" the improperly stored data so that you can proceed with the design change you have made. Write a sub that parses the current text field and creates a row in the many side table for each one.

Comboboxes cannot show multiple selections since they can only be bound to a single column. Unbound listboxes can show multiple selections but populating them will take a considerable amount of complex code. A subform is trivial and requires NO code for the same purpose.