Update field based on list box choices

  • Thread starter Thread starter Caroline
  • Start date Start date
C

Caroline

I have created a list box that has numerous choices to
describe someone's medical problem. I would like to be
able to check off multiple choices in the box and have
those choices update in another field on the same form.
For example if from the list I chose headache, nausea,
and heartburn, I would like those 3 choices to appear in
the field next to it on the form as 'headache, nausea,
heartburn'

I have created the list box and changed the property
Multi Select to Simple so that I can choose more than one
item from the list. I am missing the part to update the
other field with these values. I would also like to be
able to un-select a value and have it removed from the
other field.

Any help is greatly appreciated.
 
It is VERY bad practice to store multiple values in a single field. It
breaks the very first rule of database design. It will cause you nothing
but headaches down the road -- especially in queries. My advise is to store
these value (each in a separate record) in a related table.

For a sample of that, look on my website (see sig below) for a sample
called: "ListBoxSetTableValue.mdb", and also one called "MultiSelect.mdb"

If you REALLY want to do it your way, there is a sample called
"CreateQueries2.mdb" which uses a listbox to programmatically create a
query. You could use the query string builder code to create a string to
put in your field.
--
--Roger Carlson
www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Thank you very much for your reply. I have gotten some
ideas on how to tackle my problem. However, I would like
to store multiple items in one field. I agree that this
is not good practice but for this application it is not
going to be an issue.
I am still needing some guidance however. Whatever you
can do to help me is appreciated. I have a field
called 'related complaint upper' and in it lists a bunch
of medical conditions. I have set the the multi-select
property to Simple so that I can select more than one
item on the list. Then I have created a button on the
form that I would like to be able to push which would run
some sort of Event Procedure and would populate another
field on the form called 'Related Complaints'. These
would be kept on a table. My trouble is figuring out the
correct Event Procedure to do this update.
I am taking this project over from someone else. They
originally had an Event Procedure in the first field
called 'related complaint upper' that would work on a
double click. The problem was that once the user double-
clicked an item from the list it went right away to
the 'Related Complaints' field and they didn't have a way
to unselect it. I think that with a button that will
solve the problem they were having. They can just select
all the items, when they are sure of what they have, they
can click the update button. I tried to move the Event
Procedure from where they had it originally ('related
complaint upper') and put it with the button but that did
not work.

Any help would be greatly appreciated.
 
Back
Top