Solved

Including an expression in a query

Posted on 2013-06-11
2
250 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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 …

733 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