choosing mutiple values from a drop down list

  • Thread starter Trying to Finish
  • Start date
T

Trying to Finish

My database has many facilities that all use a combination of care and
supervision. How can I choose several values from a drop down list? Or...is
there a better way to do this?
 
D

Douglas J. Steele

Combo boxes are single-select.

You can select several values from a list box control if the MultiSelect
property is set appropriately.
 
S

Steve

It sounds like your tables design is incorrect! Consider .......
TblCare
CareID
TypeOfCare

TblSupervision
SupervisionID
TypeOfSupervision

TblFacility
FacilityID
FacilityName
etc

TblFacilityCareSupervision
FacilityCareSupervisionID
FacilityID
CareID
SupervisionID

Steve
(e-mail address removed)
 
L

Linq Adams via AccessMonster.com

As Doug has said, Comboboxes in Access have no native Multi-select Property
as Listboxes do. If you're trying to select multiple items from a Combobox
and add them, one at a time, to a textbox, which it sort of sounds like you
are, you can do that with a little bit of code.

Private Sub YourComboBox_AfterUpdate()
If IsNull(Me.TextBoxName) Then
Me.TextBoxName = Me.YourComboBox
Else
Me.TextBoxName = Me.TextBoxName & ", " & Me.YourComboBox
End If
End Sub

Having said that, storing multiple pieces of data in a single field is
generally a very poor idea. Sooner or later you will probably need to pull
records depending on a given combination of care/supervision, and then you'll
have a real mares nest!

A better design might be to have a checkbox tied to a separate Yes/No field
for each type of care/supervision.
 
D

Dale Fye

Did you really say " ... a yes/no field for each type of care"?

As my grandmother used to say, "Heaven forbid!" This is the last thing you
want to do in a "relational database"! NEVER, NEVER store data in field
names, which is exactly what you have to do to do what you have recommended.

A much better structure would be a have a separate table where you map
facilities to Care and level of Supervision(as Steve mentioned) .

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
L

Linq Adams via AccessMonster.com

Dale said:
Did you really say " ... a yes/no field for each type of care"?
This is the last thing you >want to do in a "relational database"! >NEVER, NEVER store data in field name

And what, exactly, do you think this type of Control is intended to \be used
for?

Patient needs Foot Care? Yes/No
Patient needs Eye Care? Yes/No
Patient needs Restraints? Yes/No

What exactly is wrong with this? You can query records to find out how many
patients need

Foot Care
Eye Care
Restraints

You think it's ptrferable to have one field with Foot Care, Eye Care and or
Restraints in it?

How would you suggest they indicate these selections?

I didn't say that the tables couldn't be set up better; my answer had nothing
to do with that, at all!It had to so with picking/storing a single bit of
information with a single control.
 
D

Dale Fye

Linq,

Creating a bunch of yes/no fields in a record is just poor database design.
What happens when you add a new type of care, or a new level of supervision;
you have to add more columns to your table, change all of your queryies and
forms, and reports.

Instead, with a relational data setup, you have a field for Facility,
another for Type Care, and another for TypeOfSupervision. You can use a
subform to enter the data. See Allen Browne's explaination at:
http://www.allenbrowne.com/casu-23.html

Dale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top