A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiselect for listbox



 
 
Thread Tools Display Modes
  #1  
Old July 12th, 2004, 03:54 PM
Jay
external usenet poster
 
Posts: n/a
Default Multiselect for listbox

I understand that it is bad to store multiple data in one field. However how could we if we wanted to by using the listbox control. I need to be able to store multiple selections in a form to a field in a table where the multiple selections have a semicolon to seperate each piece of data(the way outlook does when you select more than one recipient). For example: if you were chose peanut butter, jelly, bread. It would be stored in the sandwich field "Peanut Butter;Jelly;Bread".
  #2  
Old July 12th, 2004, 04:20 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default Multiselect for listbox

Loop through the ItemsSelected collection of the list box, concatenating the
items and separator into a string that you will assign to your field.

You will need to write another routine to perform the reverse operation in
the Form_Current event, i.e. parsing the field and selecting the items in
the list box.

Honestly, doing the job properly with a subform and related table is much
easier.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jay" wrote in message
...
I understand that it is bad to store multiple data in one field. However

how could we if we wanted to by using the listbox control. I need to be
able to store multiple selections in a form to a field in a table where the
multiple selections have a semicolon to seperate each piece of data(the way
outlook does when you select more than one recipient). For example: if you
were chose peanut butter, jelly, bread. It would be stored in the sandwich
field "Peanut Butter;Jelly;Bread".


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the results of a Multiselect list Deb Smith Using Forms 1 June 16th, 2004 02:55 AM
MultiSelect Outta Luck Using Forms 1 June 15th, 2004 03:28 PM
Averaging multiple ranges through multiselect listbox ZX210 General Discussion 1 June 14th, 2004 11:36 PM


All times are GMT +1. The time now is 12:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.