drop-down menus

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

Guest

Hi

I have several fields in a form where numeric codes are entered. I need for
only the number of the code to end up in the field, but I'd like for the
drop-down menu to display both the number and what it stands for, since some
of them aren't intuitive.

Is there a way to do this?

Thank you!
Christine
 
Yes, build a comb box...(use the wizard). Make sure you include BOTH
columns, the "code number" and the description column.

When you open, or try to select from the comb box, it will display both
columns. (careful..the wizard will hide the first column if it is a primary
key).

Anyway, build the combo with two columns.

Then, place a text box beside the combo box, and set its control source to
display he 2nd column. the data source for this box will look like

=([mycomboBox].column(1))

(note that column(0) = first column).

And, note that you can do the above with more then one column.....
 
Christine,

You've described exactly the functionality of both a listbox and a combobox.
With your form in design view, use the wizard to help you create the
control.

Brian
 
OK just a few more questions.

I assume I should then have both the 'code' values and descriptions in a
table to link the combo box to?

Also, if the combo box will display both columns, why do I need the text box?

Thank you!
 
Rabbit said:
OK just a few more questions.

I assume I should then have both the 'code' values and descriptions in a
table to link the combo box to?

Yes, in fact, I did assume you have this already table. Otherwise, where was
the description to come from that you were talking about?

However, your above assumption is spot on!!!
Also, if the combo box will display both columns, why do I need the text
box?

good question!!. This one you have to try your self. Each column in the
combo box only appears when the combo box is "dropped" down. So, as you make
a selection from the combo box, you see all of the columns (as mentioned,
the first column is often hidden). When you select from the combo box..it
closes,..and you only see one value (one column)

So, yes, it assumed you have a table of codes + description. Perhaps even
more fields are in this table. (a typical example would be a parts table
with part number, part description, color...etc......

often, you will actually store the primary key value (id), and still enter
the code and description fields. In this case, id will be stored, but the
next column you choose will display for you....
 
Worked perfectly. Thank you!

Albert D.Kallal said:
Yes, in fact, I did assume you have this already table. Otherwise, where was
the description to come from that you were talking about?

However, your above assumption is spot on!!!


good question!!. This one you have to try your self. Each column in the
combo box only appears when the combo box is "dropped" down. So, as you make
a selection from the combo box, you see all of the columns (as mentioned,
the first column is often hidden). When you select from the combo box..it
closes,..and you only see one value (one column)

So, yes, it assumed you have a table of codes + description. Perhaps even
more fields are in this table. (a typical example would be a parts table
with part number, part description, color...etc......

often, you will actually store the primary key value (id), and still enter
the code and description fields. In this case, id will be stored, but the
next column you choose will display for you....


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal
 
Back
Top