Andy Davies <> wrote:
>> Ok, if you NZ() you can shove a value in for the null in access. 
>> Took 5 different MVPs before the sixth came in with that little
>> trick. 
> 
> I'm guessing this is a VB 'feature' and not specific to Access
> (Verity Stob has a nice diatribe about the inconsistencies of Basic -
> well worth googling for) - for example PL/SQL and VFP use nvl(var,
> varIfNull) - just to prove it's different T-SQL has isnull(var,
> varIfNull), VB and VFP have isnull(var) which returns True or False
> (VB explains the need for this funtion with the magnificently False
> statement "because any expression containing a Null is itself Null
> and, therefore, False"       

Ok, here are the tries :
SELECT 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,

iif(isNull([Shirt 1]) ,0,1) AS Shirttotal3,

iif(isNull([Trouser 1]) ,0,1)+iif(isNull([Trouser 1]) 
,0,2)+iif(isNull([Trouser 3]) ,0,1)+iif(isNull([Trouser 4]) ,0,1) AS 
Trtotal4,

IIf(len(trim([Shirt 1]))=0,0,1) AS sh1, IIf(len(trim([Trouser 1]))=0,0,1) AS

tr1, IIf([Shirt 1]<="   ",0,1) AS sh2,

IIf([Trouser 1]<="   ",0,1) AS tr2, len(trim([Shirt 1])) AS sh01,
len(trim([Trouser 1])) AS tr01,

IIf([Shirt 1]="",0,1)+IIf([Shirt 2]="",0,1)+IIf([Shirt 3]="",0,1)+IIf([Shirt

4]="",0,1) AS ShirtTotal_1,

 IIf([Trouser 1]="",0,1)+IIf([Trouser 2] ="",0,1)+IIf([Trouser 
3]="",0,1)+IIf([Trouser 4]="",0,1) AS ShirtTotal_2,

IIf(Len(Trim([Shirt 1] & ""))>0, 1, 0)+ IIf(Len(Trim([Shirt 2] & ""))>0, 1, 
0)+IIf(Len(Trim([Shirt 3] & ""))>0, 1, 0)+IIf(Len(Trim([Shirt 4] & ""))>0, 
1, 0) AS SF1,

IIf(Len(Trim([Trouser 1] & ""))>0, 1, 0)+IIf(Len(Trim([Trouser 2] & ""))>0, 
1, 0)+IIf(Len(Trim([Trouser 3] & ""))>0, 1, 0)+IIf(Len(Trim([Trouser 4] & 
""))>0, 1, 0) AS TF1,

The last 2 got it right.  Notice early on was a isNull().  Not working :(


Stephen Russell
DBA / .Net Developer

Memphis TN 38115
901.246-0159

http://spaces.msn.com/members/srussell/

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 9/27/2006
 



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to