How do I store numbers in an Access column and then associate some meaningful string to each value?

Because I don't want to be seeing raw numbers when I can define the meaning of each value once at for all, and have those meanings displayed in the Datasheet View, like:

ID  Name      Type

1   Jack      1 (Friend)
2   Jill      1 (Friend)
3   Diago     2 (Enemy)
4   Sally     3 (Colleague)
link|improve this question

You have a Diago as an enemy. Interesting... – random Oct 15 '09 at 13:47
3  
Not surprised. Things tend to go south once your a moderator. Interesting question thought. – Diago Oct 15 '09 at 13:55
1  
Oh lord, why did I choose that name (Diago) of the gazillion quadrillion trillion names available to human beings?! .. I think the last Diago I remember is the prehistoric tiger in Ice Age ... and he was initially an "enemy" of the protagonists, so... – Jenko Oct 15 '09 at 15:02
Actually that's where the nickname comes from. However I assumed it is because of the amount of questions I have closed. – Diago Oct 15 '09 at 15:16
feedback

2 Answers

up vote 2 down vote accepted

You need to create a table which contains the relevant values for each number. Then simply create a relationship between the primary table and the secondary table. This would be the simplest and correct way of doing. However I have to admit I can't remember step by step how to do this in Access. However Microsoft has a fairly good article on how to do this here.

As far as the display is concerned you will create a new data view that retrieves the display value instead of the number and link everything to the view.

I am not aware of any other way to do this in Access.

link|improve this answer
feedback

You can create a separate table that maps a numeric value to a meaningful string, then when you display in the datasheet link the numeric value to the string using the new table:

Table: People
ID  Name      Type

1   Jack      1
2   Jill      1
3   Diago     2
4   Sally     3


Table: Types
ID  TypeString

1   Friend
2   Enemy
3   Colleague
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.