combo boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Developing a form with combo boxes for a medical document. When i click on
the arrow it will list all options (left to right) and they are all
highlighted. No matter what choice I make the first option is always placed
in the box. Can't figure this out, this is my first DB. Any suggestions?
 
tedkilroy said:
Developing a form with combo boxes for a medical document. When i
click on the arrow it will list all options (left to right) and they
are all highlighted. No matter what choice I make the first option is
always placed in the box. Can't figure this out, this is my first DB.
Any suggestions?

A combo box is designed to place just one item in a field.
Usually this should be the key to the record you are showing.
The additional information is for "your" use, not the machines.
Here's two records. (names are real, I worked in a store one summer where
both these guys worked.)

ID Last First Middle phone
1111 Smith Donald Leroy 555-1234
2222 Smith Donald Leroy 555-6483

The combo would only show
Smith Donald Leroy 555-1234
Smith Donald Leroy 555-6483

You can only tell which one you want by the phone number in this case.

If this was for a prescription the only information you would add to the
Prescription table would be the ID of the patient you want.
Your form would be based on a query relating the prescription information to
the Patient table.
When you selected 1111 the query would automatically display the proper
name.
 
Hi, Ted.

A combo box display shows records from top to bottom, and fields of the
record in columns from left to right. Its behavior is controlled by several
key combo box properties.

What is displayed in the dropdown list are all non-zero-width columns (as
defined in the Column Widths property) of the query defined in Row Source.
What is displayed after a selection is the *first* non-zero-width column,
moving from left to right. What is *stored* in the underlying field (defined
in the Control Source property) is the Bound Column.

As an example, let's say your combo box had the following properties:

Row Source SELECT Cust.ID, Cust.Name, Cust.City, Cust.Phone FROM
Cust ORDER BY Cust.Name
Bound Column 1
ControlSource Customer
ColumnWidths 0";1";1"'1"

Each row of the dropdown would display the name, city, and phone. When a
selection is made, since the first column width is 0", the customer name
would display. Since the Bound Column is 1, the Cust.ID would be stored in
the underlying Customer field.

Hope that helps. If you need more assistance, please post these properties
of your combo box, and tell us what you'd like to have happen.

Hope that helps.
Sprinks
 
thanks for the information, perhaps a drop/combo box won't work for what i am
trying to accomplish. I was thinking if i had for ex:
Disability:
x amount of choices
I could place a drop/combo box in design view and when the form is complete
my users would click on the down arrow and choose 1 of 8 choices then proceed
to the next question/combo box. Is this not applicable in access? As it is
now I have the following:
Row Source "Blind/Visual Imp.";"Sensory Imp.";"Spinal Cord
Injury";"Non Spinal/Amputation";"Mental/Emotional";"Cognitive";"System
Disease";"Traumatic Brain Inj.";"Other"
Bound Column 1
ControlSource (blank)
ColumnWidths 1";1";1";1.2077";1";1";1";1";1"
 
Hi, Ted.

Using a combo box to allow your user to pick from choices is an excellent
thing to do in Access. But, you pick your values from Rows in the combo box,
not columns. Each row is a unique value, and the Bound Column will be stored
in the Control Source underlying field.

From your posted properties, yours is a ValueList type of combo box in that
you've entered the values you'd like manually. However, your ColumnCount
property should be set to 1, the ListRows property set to 8, and the
ColumnWidths property should be set to say, 1.3". If you change this, your
box should display the values as different rows and allow you to pick any of
them.

With your Control Source set to nothing, you are not storing the chosen
value in any of the form's underlying fields. This may be as you wish. If
not, change the ControlSource to the name of the field in which you want the
chosen value stored.

One other note: a "Value List" type of combo box is fine for a small number
of static values, but understand that if the values will change somewhat over
time, or if you are storing the chosen values in the underlying table, it's
normally preferable to create a table with the values in it, each with its
unique numeric key. The table is easily edited for future changes, and you
store only the numeric key in the underlying table, rather than the entire
text.

Hope that helps.
Sprinks
 
sprinks thanks for the helpful information. not to dry up he well, but do you
know if there is a way to have a drop down/combo box that allows a user to
make more than one choice. if the question ask to "check all that apply" the
user can choose more than one answer? I have only looked so far in the access
help section and on this discussion section but have found no answer yet.
 
Hi, Ted.

Yes, multiple selections may be made from a List Box if its MultiSelect
property is set to something other than "None", however, you must use code to
either insert records or take action based on these selections:

Dim intIndex as Variant
intIndex = 1
For Each intIndex In lstYourListBox.ItemsSelected
... take action here...
Next intIndex

Hope that helps.
Sprinks
 
Hi Sprinks, Hope you are still out there on the net. I have a similar issue
as Ted and this also is my first db/ I have created tables that are the drop
down lists in my db. I need the users to be able to select multiple items
from each list. For example under test type they have 5 choices
(paper/pencil, web survey, phone survey, focus group, on-line assessment).
In some cases they need to select more than one from the list. However, the
way I have it now if they select one and then another, the first one goes
away. Suggestions?
Dave
 
DaveGuile said:
Hi Sprinks, Hope you are still out there on the net. I have a
similar issue as Ted and this also is my first db/ I have created
tables that are the drop down lists in my db. I need the users to be
able to select multiple items from each list. For example under test
type they have 5 choices (paper/pencil, web survey, phone survey,
focus group, on-line assessment). In some cases they need to select
more than one from the list. However, the way I have it now if they
select one and then another, the first one goes away. Suggestions?
Dave

Your table design is incorrect. You have a one-to-many relationship (one
"whatever" to many "test types"). A one-to-many relationship needs to be
modeled with two tables, not one table with multiple items stuffed into a
single field. A field should never contain more than one piece of data.
 
Hi, Dave.

Yes, as Rick notes, if you wish to select multiple types from your ListBox,
you inherently have a one-to-many relationship. If you wish to implement a
list box to permit more than one selection, you will have to:

- Set the List Box' MultiSelect property to "Simple" or "Extended", rather
than "None", which will allow you to select more than one value (see Help for
their differences)
- Write and debug custom code, similar to what I provided to Ted, to insert
multiple records into the "many" table at some action (say, pressing a
command button)

I think it is simpler to move this field to a separate table consisting of
the main table's primary key and a numeric code for the selection, creating a
subform to be placed on the main form, and letting your user select one or
more values in the subform. No code required.

Hope that helps.
Sprinks

To do as you wish, you will need to leave the list box unbound, and then
take action on some event
 
Back
Top