Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple selections in Listbox stored in tabl???

Status
Not open for further replies.

weberbill

MIS
Sep 13, 2002
14
US
Is it possible to select (for example) 5 items from a Listbox and have them stored in a field in a table. I have tried using the field as the control source with no luck. I would appreciate any and ALL help... thank you so much.


Bill Weber
weweber3@hotmail.com
 
Think it through in structure ( schema ) and Normalisation Rules terms Bill.

If you could store all five in the same field, the data would no longer be 'atomic'.


The solution is to have an additional table to store the information in.

Given a main table :-
tblMain
MainId
OtherMainTableFilds
etc..

and a lookup table - that provides the RowSource for the ListBox :-
tblListLookUp
ListLookUpId
ListDescription
etc..


Then you'll need a table
tblMainList
MainRef Foreign Key to tblMain and Joint PrimeKey
ListRef Foreign Key to tblListLookUp & Joint PrimeKey


Then in the ListBox's AfterUpdate event you'll need to write some code that writes new additions to, and deletes removals from, the tblMainList.
Open a RecordSet on the tblMainList WHERE MainRef = mainForm's MainId. Then validate each entry in turn.

If you need help on Recordsets then let us know which version of Access you are running because DAO is substantially different to ADO.


'ope-that-'elps.
G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Well....

I don't know if that answered my question or not... I don't think I have the knowledge to figure out if it did or not.

I just want to take multiple selections from a list box, somtimes 3 selections, sometimes 10 selections and store them in one field in a table. If what you described above with work, could you send me a sample. Again, pardon my ignorance. Thank you in advance.

Bill Weber
 
Bill,

Send me a small database with the table that you want bound to the form and the table that contains the listed contents of the list box, and the form that this is all to take place on.

I'll then write the code and post it all back here for everyone else to see.

It will be easier that way to show you how it works and others will benefit as well.


G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top