Question : Help in MS ACCESS 2007 SWITCH() Syntax

Hello Experts,
What i'm trying to do is incorporate a CASE statement in MS access DB using SWITCH() but for one good reason i'm getting an error due to incorrect syntax, Can you please show me how to address my issue....
In MS SQL....
SELECT a.*,
             CASE WHEN b.col2 = '' THEN 'No Data'
                        WHEN b.col2 IS NULL THEN 'No Data'
                        WHEN b.col2 > 1000 THEN 'Wrong Data'
                        WHEN b.col2 < 10 THE "Wrong Data'
                        ELSE b.col2 END as Col2
FROM tbl1 a
     tbl2 b
WHERE a.col1 = b.col3
AND a.col4 = 120

Where my MS Access SQL which encounters an error...


SELECT a.*,
             SWITCH(
             b.col2 = '', "No Data",
             b.col2 IS NULL, "No Data",
             b.col2 > 1000, "Wrong Data",
             b.col2 < 10, "Wrong Data",
             True, b.Col2
             ) as Col2

FROM tbl1 a
     tbl2 b
WHERE a.col1 = b.col3
AND a.col4 = 120
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
MS SQL...
SELECT a.*,
             CASE WHEN b.col2 = '' THEN 'No Data'
                        WHEN b.col2 IS NULL THEN 'No Data'
                        WHEN b.col2 > 1000 THEN 'Wrong Data'
                        WHEN b.col2 < 10 THE "Wrong Data'
                        ELSE b.col2 END as Col2
FROM tbl1 a
     tbl2 b
WHERE a.col1 = b.col3
AND a.col4 = 120



MS ACCESS SITCH() which encounters an error....


SELECT a.*,
             SWITCH(
             b.col2 = '', "No Data",
             b.col2 IS NULL, "No Data",
             b.col2 > 1000, "Wrong Data",
             b.col2 < 10, "Wrong Data",
             True, b.Col2
             ) as Col2

FROM tbl1 a
     tbl2 b
WHERE a.col1 = b.col3
AND a.col4 = 120

Answer : Help in MS ACCESS 2007 SWITCH() Syntax

Missing comma?

SELECT a.*,
             SWITCH(
             b.col2 = '', "No Data",
             b.col2 IS NULL, "No Data",
             b.col2 > 1000, "Wrong Data",
             b.col2 < 10, "Wrong Data",
             True, b.Col2
             ) as Col2

FROM tbl1 a, tbl2 b
WHERE a.col1 = b.col3
AND a.col4 = 120
Random Solutions  
 
programming4us programming4us