Re: syntax in long iif
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Wed, 28 Feb 2007 11:57:38 -0500
Paretheses are your enemy. You need add a couple closing parentheses at the
end of the expression and remove them from the middle
IIF( [TableE].[Sites] >0 and [TableE].[Subjects]=0,
"Sites ("&[TableE].[Sites]&")",
IIF([TableE].[Sites] =0 and [TableE].[Subjects]>0,
"Subjects (&[TableE].[Subjects]&")",
IIF ([TableE].[Sites] >0 and [TableE].[Subjects]>0,
"Sites ("&[TableE].[Sites]& ") Subjects(" & [TableE].[Subjects] & ")" )))
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
"Jennyrd" <Jennyrd@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:14168910-84B0-49F0-9F81-09325DA48FE0@xxxxxxxxxxxxxxxx
I'm doing a long conditional statement that checks if 2 fields have 0 or
>0
values. It must be a problem with the syntax I'm using. Here's my code
that
is erroring out:
Currently: iif( [TableE].[Sites] >0 and [TableE].[Subjects]=0,"Sites
("&[TableE].[Sites]&")"), iif ([TableE].[Sites] =0 and
[TableE].[Subjects]>0,"Subjects (&[TableE].[Subjects]&")"), iif
([TableE].[Sites] >0 and [TableE].[Subjects]>0,"Sites ("&[TableE].[Sites]&
")
Subjects(" & [TableE].[Subjects] & ")")
Let me translate what I'm trying to do here for those who may be mystified
at my code :) :
if sites >0 and subjects=0 then Sites(1)
or
if sites=0 and subjects>0 then Subjects(15)
or
if sites and subjects >0 then Sites(8) Subjects(10)
Thanks a ton for any useful suggestions!!!
-Jenny
.
- Prev by Date: Re: Finding a text field in a field
- Next by Date: Re: Searching mutiple fields with the same string
- Previous by thread: Re: Finding a text field in a field
- Next by thread: Re: syntax in long iif
- Index(es):
Relevant Pages
|
|