Where to place a Case statement

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
 
G

ghetto_banjo

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...
 
J

JWCrosby

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
 
J

John Spencer

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
'====================================================
 

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