I am using Access 2007. I have several tables created for Purchase Order and
a Purchase Order subform. The purchase order has the purchase order subform
embedded in it. I have several combo boxes in the form. The combo boxes are
for supplies and shipping methods. When I open the combo box and select the
supplier and/or shipping method and close the form the info is saved for that
particular purchase order. When I open the form again, the info is displayed
as it should be. When I go to the underlying table that should be storing
all the information under the suppliers and shipping methods it displays the
id number instead. I am sure this is something very, very simple, but I
can't seen to see what the problem is. Thanks for your help.
There are multiple things going on at the same time for a combo box.
A) There is a "Bound" Column. This is the ONE field from the query
that will be saved in a field if the combo box is bound to a field in
a table. It is also the field value that will be returned if you
simply address the combobox field (example msgbox me.comboboxname)
B) There is the number of columns which tells you HOW Many fields are
being returned from the query.
C) There is the FIELD Lengths which define how much space (if any)
each field in that combo box will use in the display when you press
the arrow at the end of the combo box. Once you chose one of the
entries, ONLY the first field that has an actual length will show in
the combobox space, and this may or may NOT be the value that is
saved/
stored (item A above)
D) There is the "Limit to List" property. This will say whether or
not
an entry can be made in the box that is NOT in the underlying query
in
the field that is visible. (the first non 0 lengh field returned from
the query.
You can address any and ALL fields of data returned from the query by
using the .column property as Dave showed you in the prior post.
Dave's answer assumed that you were trying to load a separate txtbox
with the information from the selected emplyee. That will work BUT
the
only item that will show in the combo box - given the way you are
pulling the info with the query - is one of the name fields. in which
case you will have a problem if there are multiple entries for the
same single field value showing. (For instance Smith when there are
multiple lastname Smiths in the emplyee list.)
If you want to show all three in the "COMBOBOX" then you will need
to
create a dynamic field in your query that concatenates the three into
a single field and have that be the visible and maybe bound field.
All of the above is why - for an employee table - the employee number
is usually the bound field and first displayed field and the name etc
are also shown with the dropdown BUT then loaded for display into a
separate txt field. That way you will always have the right person's
information saved in your record and displayed EVEN when she gets
married/divorced and changes her name.
And the part number is saved/shown so that when the description
changes your tables still work.
AND that is why - most probably - you see the ID Number of the part in
the data instead of the displayed information from the combobox.
Ron