Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function to select text strings

Status
Not open for further replies.

jonnysnow

Programmer
Apr 10, 2003
36
US
There should be a function I'm just not familiar with. I have a table with a coded variable, CLINIC. I want to produce a string on a report, depending on what the variable CLINIC holds.

Example:

CLINIC could be: MGH, HMC, JMH

and on the report, I want:

MGH = Meadowbrook General Hospital
HMC = Harris Medical Center
JMH = Jefferson Memorial Hospital

I know I can use 'Iif':

Iif( [CLINIC] = 'MGH', 'Meadowbrook General Hospital', Iif( [CLINIC] = 'HMC', 'Harris Medical Center', Iif ( [CLINIC] = 'JMH', 'Jefferson Memorial Hospital', '*** BAD VALUE ***')))

But isn't there a simpler way? In this example, I have six different values.
 
Wait!! I realized an obvious way to do this. Just have a translation table of coded value to text string.

Sorry I posted too fast!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top