|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
IIF doesn't work
This is probably very simple, but I can't get passed this problem.
I have a report in MS Access that uses info generated by a query. One of the text fields in the query contains either the word 'Select' or the name of a course. The report should display a space if the value is 'Select', or the actual value of the field in any other case. The field can never contain a null value. I've used: =IIf([optVoc1]="Select","",[optVoc1]) in the text box on the report, but this only returns #error regardless of the actual content of the field. What am I doing wrong? Regards, BD |
|
#2
|
||||
|
||||
|
try using the single quote (') instead of the doublequotes (") to delimit your strings
|
|
#3
|
|||
|
|||
|
Thanks, that didn't work.
It doesn't seem to want me to compare a string value in the field (which is a text field) with a literal. I can't believe this shouldn't work. It does work if I use numeric values againts numeric fields. Regards, BD |
|
#4
|
|||
|
|||
|
Try just single quotes around select and keep double in place for the space
=IIf([optVoc1]='Select'," ",[optVoc1]) |
|
#5
|
|||
|
|||
|
Case
Try the CASE statement
CASE input_expression WHEN when_expression THEN result_expression [ ...n ] [ ELSE else_result_expression ] END Case [optVoc1] WHEN 'Select' THEN ' ' ELSE [optVoc1] |
|
#6
|
|||
|
|||
|
I forgot the END
Quote:
Case [optVoc1] WHEN 'Select' THEN ' ' ELSE [optVoc1] END |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > IIF doesn't work |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|