Solved

Including an expression in a query

Posted on 2013-06-11
2
242 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
2 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now