Switch Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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????
 
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top