Switch Statement

M

Matt

I am using the Switch function in a Query as Criteria for a column. The code
is below:

Switch([Forms]![TargetMain]![PriorityCMB]=" All
Values",CDbl([TargetMaster]![MapCode])>1,[Forms]![TargetMain]![PriorityCMB]="1st
Priority",4,[Forms]![TargetMain]![PriorityCMB]="Strength",2,[Forms]![TargetMain]![PriorityCMB]="2nd Priority",3)

The problem is when "All Values" is selected, I am not getting the correct
values. I take it Switch statements in the Criteria allow 1 value only????
 
J

John Vinson

I am using the Switch function in a Query as Criteria for a column. The code
is below:

Switch([Forms]![TargetMain]![PriorityCMB]=" All
Values",CDbl([TargetMaster]![MapCode])>1,[Forms]![TargetMain]![PriorityCMB]="1st
Priority",4,[Forms]![TargetMain]![PriorityCMB]="Strength",2,[Forms]![TargetMain]![PriorityCMB]="2nd Priority",3)

The problem is when "All Values" is selected, I am not getting the correct
values. I take it Switch statements in the Criteria allow 1 value only????

No, it takes scores. But the text strings

"All Values"
and
" All Values"

are not identical. What's the actual value of the PriorityCMB field?
Does it contain the leading blank, and does your Switch() function?

John W. Vinson[MVP]
 
Top