Variables Not Allowed in CASE Statement of SELECT CASE Block (43264)
This article was previously published under Q43264
SUMMARY
The SELECT CASE block does not allow variables in the CASE statements.
As an alternative, using multiple IF statements is recommended.
Code Example
The following code example gives a "Syntax Error" on the CASE x line:
x=1
y=1
SELECT CASE y
CASE 0
PRINT "Zero"
CASE x ' This line causes error
PRINT "XXX"
CASE ELSE
END SELECT
This is an example of the workaround using multiple IF statements:
x=1
y=1
IF y=0 THEN
PRINT "Zero"
ELSEIF y=x THEN
PRINT "XXX"
ELSE
END IF
Modification Type: |
Minor |
Last Reviewed: |
1/8/2003 |
Keywords: |
KB43264 |
|