Connecting Tech Pros Worldwide Forums | Help | Site Map

NZ & IIF

Ray
Guest
 
Posts: n/a
#1: Nov 12 '05
I use the expression below in a crosstab query and it works fine.
However, else where I would like to sum the four levels but on
ocassions some of the levels are null. Can anyone tell me how to use
the NZ function with this query to overcome the NULL entries or should
I be looking at some other function?

TIA - Ray

IIf([ReadingTotal]) Between 0 And 19,"Level 1",IIf([ReadingTotal])
Between 20 And 37,"Level 2",IIf([ReadingTotal]) Between 38 And
55,"Level 3",IIf([ReadingTotal]) Between 56 And 75,"Level 4"))))

TC
Guest
 
Posts: n/a
#2: Nov 12 '05

re: NZ & IIF


Say you normally have:

IIF ([blah] BETWEEN 11 AND 33, ...

but [blah] might sometimes be null.


If you want null values to >pass< the BETWEEN test:

IIF ( NZ ([blah], 1) BETWEEN 1 AND 9, ...


If you want them to >fail<:

IIF ( NZ ([blah], 0) BETWEEN 1 AND 9, ...


HTH,
TC


"Ray" <wattles@xtra.co.nz> wrote in message
news:4205783b.0311221933.55d8601d@posting.google.c om...[color=blue]
> I use the expression below in a crosstab query and it works fine.
> However, else where I would like to sum the four levels but on
> ocassions some of the levels are null. Can anyone tell me how to use
> the NZ function with this query to overcome the NULL entries or should
> I be looking at some other function?
>
> TIA - Ray
>
> IIf([ReadingTotal]) Between 0 And 19,"Level 1",IIf([ReadingTotal])
> Between 20 And 37,"Level 2",IIf([ReadingTotal]) Between 38 And
> 55,"Level 3",IIf([ReadingTotal]) Between 56 And 75,"Level 4"))))[/color]


TC
Guest
 
Posts: n/a
#3: Nov 12 '05

re: NZ & IIF


Sorry, I changed from 11..33 to 1..9 midstream! But you get the idea.

TC


"TC" <a@b.c.d> wrote in message news:1069561203.312013@teuthos...[color=blue]
> Say you normally have:
>
> IIF ([blah] BETWEEN 11 AND 33, ...
>
> but [blah] might sometimes be null.
>
>
> If you want null values to >pass< the BETWEEN test:
>
> IIF ( NZ ([blah], 1) BETWEEN 1 AND 9, ...
>
>
> If you want them to >fail<:
>
> IIF ( NZ ([blah], 0) BETWEEN 1 AND 9, ...
>
>
> HTH,
> TC
>
>
> "Ray" <wattles@xtra.co.nz> wrote in message
> news:4205783b.0311221933.55d8601d@posting.google.c om...[color=green]
> > I use the expression below in a crosstab query and it works fine.
> > However, else where I would like to sum the four levels but on
> > ocassions some of the levels are null. Can anyone tell me how to use
> > the NZ function with this query to overcome the NULL entries or should
> > I be looking at some other function?
> >
> > TIA - Ray
> >
> > IIf([ReadingTotal]) Between 0 And 19,"Level 1",IIf([ReadingTotal])
> > Between 20 And 37,"Level 2",IIf([ReadingTotal]) Between 38 And
> > 55,"Level 3",IIf([ReadingTotal]) Between 56 And 75,"Level 4"))))[/color]
>
>[/color]


Closed Thread


Similar Microsoft Access / VBA bytes