Re: IsEmpty() not giving expected results
- From: "Dale Fye" <dale.fye@xxxxxxxxxx>
- Date: Thu, 28 Sep 2006 21:44:50 -0400
Stephen,
The best way I've figured to do what you are doing is something like:
Alterations.Date,
IIF(TRIM(NZ([Shirt 1], "")) = "", 0, 1) _
+ IIF(TRIM(NZ([Shirt 2], "")) = "", 0, 1) _
+ IIF(TRIM(NZ([Shirt 3], "")) = "", 0, 1) )
+ IIF(TRIM(NZ([Shirt 4], "")) = "", 0, 1) as Shirt Total,
The NZ([Shirt 1], "") will return the value in [Shirt 1] if it is not null,
and an empty string if it is null. Also, you cannot just use TRIM([Shirt
1]) if you don't know whether that value is NULL, because TRIM(NULL) will
return an error.
Trimming the result of the NZ( ) operation will strip all the spaces from
the result, so if the field is null, or has a zero length string, or has
nothing but spaces in the string, it will return an empty string. Test that
value against an empty string ("") and set the value appropriately
HTH
Dale
"SRussell" <srussell@xxxxxxxxxxx> wrote in message
news:%23mq4tez4GHA.3840@xxxxxxxxxxxxxxxxxxxxxxx
I am trying to get a count of how many columns have data entered. This is
non normalized and I'm not paid to fix that :( So I am trying to get the
count of shirts in this case.
Alterations.Date, IIf([Shirt 1]=" ",0,1)+IIf([Shirt 2]="
",0,1)+IIf([Shirt 3]=" ",0,1)+IIf([Shirt 4]=" ",0,1) AS ShirtTotal,
IIf(IsEmpty([Shirt 1]),0,1)+IIf(isEmpty([Shirt 2]),0,1)+IIf(isEmpty([Shirt
3]),0,1)+IIf(isEmpty([Shirt 4]),0,1) AS ShirtTotal2,
column is char(50) for all of the shirts.
how do I get a count of this, I guess that I am close?
TIA
__Stephen
.
- Prev by Date: Re: Plotting price changes.
- Next by Date: Re: One to many back to one string
- Previous by thread: Re: IsEmpty() not giving expected results
- Next by thread: Re: permissions problem?
- Index(es):
Relevant Pages
|