A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2009, 04:30 AM posted to microsoft.public.access.forms
Tommie
external usenet poster
 
Posts: 18
Default How to associate predefined numeric value to drop-down list option

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!
  #2  
Old April 18th, 2009, 04:59 AM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default How to associate predefined numeric value to drop-down list option

"Tommie" wrote in message
...
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.


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada



  #3  
Old April 18th, 2009, 05:04 AM posted to microsoft.public.access.forms
Arvin Meyer MVP
external usenet poster
 
Posts: 640
Default How to associate predefined numeric value to drop-down list option

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.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Tommie" wrote in message
...
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!



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.