Change text to different description

G

Guest

I've inherited a database that needs changes, and haven't worked with Access
much lately and I'm stuck for an answer. I have a query that works just fine
that returns Region: 01, Region: 02, Region: 03, or Region: 04 depending on
what region a store is in. The database owner has requested corresponding
text with each Region which would be Region: 01 Western, Region: 02 Southern,
Region: 03 Northern, Region: 04 Central. I tried an update query but I can't
update the original table; not authorized (hugh central info tables that I'd
rather not touch/destroy so it's okay with me that I can't). I haven't
worked with SQL in awhile but I think I can do this using SQL. Is there any
other way? I tried creating another field and using expression builder with
an If statement, with no success. Feeling pretty stupid right now, would
really appreciate the help!
 
G

Guest

Hi

You can use the switch function. Something like...

SELECT region, Switch(region="01", "Western", region="02", "Southern",
region="03", "Northern", region="04", "Central") AS Region_Name
FROM tblRegions;

Or create your own table (if you have permission) with 2 columns:
RegionNumber and RegionName then just join to this table in every query you
want to translate the region number.

Regards

Andy Hull
 
G

Guest

Thanks for your response Andy. I ended up in SQL using an IIf statement
which works fine, but will keep Switch in mind for the next time. Thanks
again!
 

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