sql conditional statements

trixxnixon

Registered User.
Local time
Yesterday, 21:36
Joined
Sep 28, 2008
Messages
10
i have to introduce a new field now, but i need it to calculate based on a condition being true. the new field is Sumofdays.
the calculation should not calculate if sumofdays
here is my logic. but i know this syntax is way off.
Code:
if isnull(sumofdays)=true then
DIH =Workingdays2(DateValue([Date Submitted]),[Date Completed])  
else
Workingdays2(DateValue([Date Submitted]),[Date Completed])- ([Sumofdays})
end if
when i try to use an iif statement, even a simple one i get a
here is what im using in the query design view

Code:
NDIH: IIf(IsNull([sumofdays]),Workingdays2(DateValue([Date Submitted]),[Date Completed]),Workingdays2(DateValue([Date Submitted]),[Date Completed])-[(sumofdays])
but i keep getting the paramater input request. what might i be doing wrong?

Thanks!
 
I suspect sumof days is an alias ie Sum(days) as sumof days, Aliases cannot be used in criteria
isnull(sum(days) has to be used

Brian
 

Users who are viewing this thread

Back
Top Bottom