Changing a number to a code

L

Lee

How do I change a number into a word? For example, I have a questionnaire
that has a likert scale (1=never, 2=often, 3=always). I enter the answer to
the question by typing in the number. How do I change the number to the word
(never, often or always)? Should I do that in the reports? If so, how? Any
help is appreciated
 
D

Dave

Check out the Choose() function. For example, if you have a variable intFreq
that has the value 2, then

Choose(intFreq,"Never","Often","Always")

returns "Often"
 
L

Lee

Thanks for responding Dave. Is the intFreq the name of the column where the
1,2,3 is? I tried to use the choose function for the question "Was this
medicine helpful" Choose([was this medicine helpful],"Never", "Often",
"Always") and it didn't work. Help!
 
D

Dave M

Do you really have a column named [was this medicine helpful]? I'm a big
believer in meaningful field names, but that's a beauty!

Anyhow, if you have a table named "MyTable" with a numeric field named
"Response" and it can have values between 1 and 4, a query that looks like
this

SELECT Response, Choose([Response],"One","Two","Three","Four") AS [Words]
FROM MyTable;

should show you the numbers and the corresponding words.

Lee said:
Thanks for responding Dave. Is the intFreq the name of the column where the
1,2,3 is? I tried to use the choose function for the question "Was this
medicine helpful" Choose([was this medicine helpful],"Never", "Often",
"Always") and it didn't work. Help!

Dave said:
Check out the Choose() function. For example, if you have a variable intFreq
that has the value 2, then

Choose(intFreq,"Never","Often","Always")

returns "Often"

answer
to the
word how?
Any
 
L

Lee

Hey Dave, no, I really don't have a column with that name. Thanks for the
instruction, I will try it.

Dave M said:
Do you really have a column named [was this medicine helpful]? I'm a big
believer in meaningful field names, but that's a beauty!

Anyhow, if you have a table named "MyTable" with a numeric field named
"Response" and it can have values between 1 and 4, a query that looks like
this

SELECT Response, Choose([Response],"One","Two","Three","Four") AS [Words]
FROM MyTable;

should show you the numbers and the corresponding words.

Lee said:
Thanks for responding Dave. Is the intFreq the name of the column where the
1,2,3 is? I tried to use the choose function for the question "Was this
medicine helpful" Choose([was this medicine helpful],"Never", "Often",
"Always") and it didn't work. Help!

Dave said:
Check out the Choose() function. For example, if you have a variable intFreq
that has the value 2, then

Choose(intFreq,"Never","Often","Always")

returns "Often"

How do I change a number into a word? For example, I have a questionnaire
that has a likert scale (1=never, 2=often, 3=always). I enter the answer
to
the question by typing in the number. How do I change the number to the
word
(never, often or always)? Should I do that in the reports? If so, how?
Any
help is appreciated
 

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