List of items what control to use and how to store them?

P

pokdbz

I have a bunch of medications that need to be listed on a form and be
selected. I was wondering what is the best control to use for this and how
will it save the data?.

I was thinking that check boxes would be easy to use but not sure how to
implement this. Can you have a bunch of check boxes referring to a different
medications save in one field say something like: med1, med2, med3

Not sure what the best way to go about this is.
 
L

Larry Linson

I have a bunch of medications that need to be listed on a form and be
selected. I was wondering what is the best control to use for this and how
will it save the data?.

I was thinking that check boxes would be easy to use but not sure how to
implement this. Can you have a bunch of check boxes referring to a different
medications save in one field say something like: med1, med2, med3

If you have just a few... a relative "handful", then you might effectively
use check boxes or option buttons. If you have more than a few, I'd suggest
a Combo Box . . . by default, if you start typing in an Access Combo, it
will scroll to the nearest match. This is called the AutoExpand feature of
the Combo Box. Use a Row Source (that determines what data is included) that
extracts all the medications id and name, but only displays the name to the
user.

If you use the Medication field as the Control Source for this Control, it
will automatically save the selected value (as all Forms in Access do) when
you move to a different Record, close the Form, or explicitly save.

I see that your question _could_ imply that you are saving more than one
medication in the field. I hope that is not the case, because that's a
violation of relational database design rules, and could cause you problems
in the future.

Larry Linson
Microsoft Access MVP
 
S

Sprinks

Pokdbz,

This brings up a very interesting point. From the relational database
perspective, there is a natural one-to-many relationship between Patients and
"PatientMedications", implying a main form on patients, and a continuous
subform for the detail, based on PatientMedications. Each medication in the
subform could be chosen from a combo box.

But, since you have a limited number of choices for medications that can be
presented conveniently on a single screen form, the data entry would be
easier through checkboxes.

I suggest that you present a form for your user, allowing him to pick from
checkboxes, and provide a "Commit" button that then inserts the relevant
records into your detail table.

Sprinks
 

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