?
Solved

Including an expression in a query

Posted on 2013-06-11
2
Medium Priority
?
260 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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: …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Suggested Courses

777 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