Where to place a Case statement

  • Thread starter Thread starter JWCrosby
  • Start date Start date
J

JWCrosby

A field in my database stores a number from a checkbox response, values of
1,2,3 or 4. Each number represents a word or phrase off an online reference
form.
1="Very well"
2="Well"
3="Casually"
4="Hardly"

I'm designing a form that prints out a compilation of all references
responses, but I the report to show the corresponding word, not the number.
Rather than using a complex If...Then statement I'd think a Case function
would work fine, but I don't know where to put it. Should it be done at the
query level? (in which case I'll ask the question in that forum.) or ??

Thanks in advance.

Jerry
 
I am not sure where you could put a Case statement for the report, but
if you want an alternate solution, you could create a table that just
holds the numbers and the descriptions, and link that table to your
query for the report. Just an idea...
 
Yeah, that would work. But I solved the problem by changing my code on the
webpage that was gathering the data so that it now stores the phrase and not
a number. I never have more than 10-20 records in the database, so I'm not
too concerned about bloat.

Thanks for the idea, though. I may use it in another place.

Jerry
 
Best solution would be to create a table with two fields - the number
value and the words. Then you just link that table to your other table
in a query.

If that is not feasible you could use the Choose function to return the
value.

Choose(Nz([TheNumber],0),"Very Well","Well","Casually","Hardly")

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Back
Top