>Ok, i have a mulitple selection listbox, i want to store the selected values
>into one field with each value seperated by a comma in the field. Im not
>interested about how it is not good practice and how it is not good to do. I
>just want this feature on my form, i have no knowledge of VBA, so if somehow
>has the know how to do it. Can you please help me and provide the code for me?
A multiselect listbox exposes the .ItemsSelected property, so you can do this:
Dim v As Variant
Dim sData as string
For each v in YourLIstbox.ItemsSelected
sData = YourListBox.ItemsSelected(v) & "," sData
Next v
sData = left(sDAta, Len(sData)-1)
CurrentProject.Connection.Execute "UPDATE SomeTable SET YourMultiValueField='" & sData & "' WHERE SomeIDField=" &
Me.YourIDField
I realize you don't want to hear about storing multiple values in a field, but it's wrong, wrong, wrong ... there is no
easy way to search this field, and a 1-M relationship should be stored in separate tables ... but if ya wanna hose up
your data, be my guest!!
Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com