Converting number to Alphabet

J

Jack

Hi,
I got a table as follows:
Yr Eng HR Sales
05 0 0 -1
06 0 -1 0
07 -1 -1 -1

Now while selecting the data I need to show the above as:

NNS
NHN
EHS
Here N is equivalent to 0 while if it is -1 then the value will be either E
or H or S depenidng on which column belongs to. Any help is appreciated.
Thanks.
 
K

KARL DEWEY

Try this --
SELECT Jack.Yr, IIf([Eng]=0,"N","E") & IIf(
=0,"N","H") &
IIf([Sales]=0,"N","S") AS Expr1
FROM Jack;
 
D

Douglas J. Steele

Assuming all you need to do is display this (as opposed to store it), try a
query like:

SELECT Yr, IIf([Eng], "E", "N") & IIf(
, "H", "N") & IIf([Sales], "S",
"N") AS DisplayData
FROM MyTable
 
J

Jack

Thanks so much for your help Karl and Douglas. I really appreciate it.

Douglas J. Steele said:
Assuming all you need to do is display this (as opposed to store it), try a
query like:

SELECT Yr, IIf([Eng], "E", "N") & IIf(
, "H", "N") & IIf([Sales], "S",
"N") AS DisplayData
FROM MyTable

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jack said:
Hi,
I got a table as follows:
Yr Eng HR Sales
05 0 0 -1
06 0 -1 0
07 -1 -1 -1

Now while selecting the data I need to show the above as:

NNS
NHN
EHS
Here N is equivalent to 0 while if it is -1 then the value will be either
E
or H or S depenidng on which column belongs to. Any help is appreciated.
Thanks.

 

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