By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

IIF statement question

P: 3
Hi,
I am using Access 2003 on Windows XP, SP2. I am using the following IIF statement
Expand|Select|Wrap|Line Numbers
  1. Shift: IIf([i_timerec] Between 800 And 1559,"Day","Evening/Mids")
and it is giving me the two returns. I would like to add 1600 and 2359 and a get a return of Evening and 0 to 759 to get a return of Mids. Is it possible to use an IIf statement so that I could get 3 returns, so evening and mids could be seperated as well. If not does anyone know a way to get the result I am looking for. Thanks.
Jun 10 '07 #1
Share this Question
Share on Google+
2 Replies


FishVal
Expert 2.5K+
P: 2,653
Hi,
I am using Access 2003 on Windows XP, SP2. I am using the following IIF statement
[code]Shift: IIf([i_timerec] Between 800 And 1559,"Day","Evening/Mids")[code]
and it is giving me the two returns. I would like to add 1600 and 2359 and a get a return of Evening and 0 to 759 to get a return of Mids. Is it possible to use an IIf statement so that I could get 3 returns, so evening and mids could be seperated as well. If not does anyone know a way to get the result I am looking for. Thanks.
Use "Switch" function. Function syntax and example you can find in Access help.

Good luck.
Jun 10 '07 #2

NeoPa
Expert Mod 15k+
P: 31,186
Switch Function

Evaluates a list of expressions and returns a Variant value or an expression associated with the first expression in the list that is True.

Syntax

Switch(expr-1, value-1[, expr-2, value-2 [, expr-n,value-n]])

The Switch function syntax has these parts:

Part Description
expr Required. Variant expression you want to evaluate.
value Required. Value or expression to be returned if the corresponding expression is True.
This is a decent function to use for your problem. For something as straightforward as this though, some nested IIf()s would work as well (not aswell).
Expand|Select|Wrap|Line Numbers
  1. Shift: IIf([i_timerec]<800,"Mids",IIf([i_timerec]<1600,"Day","Evening"))
Jun 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.