Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Including an expression in a query

Posted on 2013-06-11
2
Medium Priority
?
265 Views
Last Modified: 2013-06-14
I would like to create a computed field in a query design window that evaluates an  expression which will output a value depending on the value of another field.

For instance, if the value of the field [Exp Grad] is "2139", it should output the value "December 2013". If the value is "2132", then it should output May 2013 and, finally, if the output is "2134", it should output "August 2013". For the last digit,  "9" stands for December, "2" stands for May and "4" stands for August. The first three digits, e.g.,  213 stands for the year (with the zero omitted), i.e., 2013.

How can I accomplish this, e.g., using the IIf or any similar expression?
0
Comment
Question by:geeta_m9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 39239425
You could use Switch for this: http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_3556-Using-the-Switch-Function-in-Microsoft-Access.html

Switch([Exp Grad] = "2139", "December 2013", [Exp Grad] = "2132", "May 2013", [Exp Grad] = "2134", "August 2013")

That said, you are probably best off creating a separate table to handle this mapping.
0
 

Author Comment

by:geeta_m9
ID: 39239486
Thanks.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question