Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
MikeB
Constraint Violating Yak Guru
387 Posts |
Posted - 2003-10-22 : 15:12:11
|
Can I use the CASE WHEN THEN END in a select statement with Access97? I cannot find any documentation on this!Mike B |
|
MikeB
Constraint Violating Yak Guru
387 Posts |
Posted - 2003-10-22 : 16:38:47
|
I have the answer! No, use iif instead! |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-10-22 : 16:40:04
|
yes !! I like IIF(), actually -- nice and tidy and short. it took me a while to get used to CASE. on the other hand, CASE can be easier to read and understand especially when nested.- Jeff |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-10-22 : 23:50:39
|
And if you have a number of expressions to evaluate, instead of using nested IIF() functions, use Switch(). It gives you the power of a CASE expression in Access. In fact, it's a little neater and cleaner than CASE sometimes. |
 |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-10-23 : 15:20:01
|
SWITCH! Oh my God...oh the poor code...IIF(IIF(IIF(IIF(IIFIf only I had known....Brett8-) |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-10-23 : 15:51:46
|
Another cool one is Choose().if you need return one of many values based on an index from 1-n, you can write:Choose(Index,Col1,Col2,Col3,Col4)and that will return Col1 if Index =1, Col2 if Index=2, etc.The only thing is Index must be from 1..n. But it can make for VERY short and easy to read code !- Jeff |
 |
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-10-24 : 05:00:17
|
Oho, Jeff,thank you! This is yet another function that I got known from you! |
 |
|
|
|
|
|
|