How to associate predefined numeric value to drop-down list option

T

Tommie

Hi everyone,

It seems to be a simple task but I don't know the proper keywords to descibe
the problem. So, rather than using google, I am asking for help here.

A field has only three possible companys: A, B, and C. They are assigned
with numeric numbers 1, 2, 3, respectively. Validation rules are established.
Now I want to create a form with a list box showing the companies' names
rather than the numbers. However, I want the values to be save as 1, 2, 3 in
the table.

Can anyone kindly give some clue? Thanks a lot!
 
A

Albert D. Kallal

Tommie said:
Hi everyone,

It seems to be a simple task but I don't know the proper keywords to
descibe
the problem. So, rather than using google, I am asking for help here.

A field has only three possible companys: A, B, and C. They are assigned
with numeric numbers 1, 2, 3, respectively. Validation rules are
established.
Now I want to create a form with a list box showing the companies' names
rather than the numbers. However, I want the values to be save as 1, 2, 3
in
the table.

Can anyone kindly give some clue? Thanks a lot!

Actually the above request as pretty much how access works by default when
you build a combo box using the wizard.

Simply create a table to store the companies. Include an auto number ID
field. Type in the first company name, and the autonumber id will be one,
now, simply type in the next two company names

in of a table with the three company names, eg:

tblCompanyNames

id CompanyName
1 Macdonalds
2 Burgar King
3 A & W


Now in that form simply use the wizard to build a combo box. When asked
where the values for the combo box or to come from simply use the above
table you made, in fact if you said ID up as what's called a primary key,
then access will actually hide the first column for you automatically. the
result be that you store the ID, but it's plays and sees the company name.

As mentioned, most combo box taxes work this way as you often are displaying
some part description or something else, but you want a store the ID or
primary key of an actual record.
 
A

Arvin Meyer MVP

Either use a table with the 3 values, or a ValueList if they will never be
changed or added to:

In the combo or List box property sheet create 2 columns, bind column 1,
(the ID value) to the Combo or List Box, Bind that column to the table
field. Set the column widths to: 0", 1"

The table will store the numeric but display the textual value.
 

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