a few syntax problems in my equations

antonyx

Arsenal Supporter
Local time
Today, 17:09
Joined
Jan 7, 2005
Messages
556
a few questions on the syntax of some arithmetic im doing in my reports..

are the two statements below correct?


=Sum(IIf([fkAccountTypeID]=2,Nz([JobTdCp],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdExtra],0))


=Sum(IIf([fkAccountTypeID]=2,Nz[JobTdFare],0)+(IIf([fkAccountTypeID]=2,[JobTdCp],0)+(IIf([fkAccountTypeID]=2[JobTdExtra]))
 
For starters - I think you're missing some parens...

:)
ken


edit: Then on the first one at least, it looks like you've missed putting in the false part of you iif()'s
 
For starters - I think you're missing some parens...

:)
ken

And I couldn't see any FALSE outputs in both IIf statements.
 
lol.. i know the score..


the only reason i am just looking for a solution is because i am sooo busy right now.. i dont even have time to post this..

seriously..

if one of you kind gentlemen could fix the syntax on those statements because i am sure they are wrong.


please..?
 
I THINK this is it:

=Sum(IIf([fkAccountTypeID]=2,Nz([JobTdCp],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdExtra],0),0))))


=Sum(IIf([fkAccountTypeID]=2,Nz[JobTdFare],0)+(IIf([fkAccountTypeID]=2,[JobTdCp],0)+(IIf([fkAccountTypeID]=2[JobTdExtra]),0))))
 
hi, thank you bob.. you have got me on the right track (i hope!)

basically all i need to do now is the following.


i want this:

=Sum(IIf([fkAccountTypeID]=2,Nz([JobTdCp],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdFare],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdExtra],0)))))))

minus this:

=Sum((IIf([fkAccountTypeID]=1,[JobTdFare],0)*[JobCom])+(IIf([fkAccountTypeID]=2,[JobTdFare],0)*[JobCom]))

im trying to use this.. but gettin completely the wrong results.

=Sum(IIf([fkAccountTypeID]=2,Nz([JobTdCp],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdFare],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdExtra],0))-((IIf([fkAccountTypeID]=1,[JobTdFare],0)*[JobCom])-(IIf([fkAccountTypeID]=2,[JobTdFare],0)*[JobCom])))))))


also.. if i am using to many brackets.. im sorry.. the first two are gettin me the results i want.. and im just kind of guessing the number of brackets at the end...
 
Wouldn't it just be taking the two exactly as they are individually written but the one that you are subtracting doesn't have the = sign in front:

=Sum(IIf([fkAccountTypeID]=2,Nz([JobTdCp],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdFare],0)+(IIf([fkAccountTypeID]=2,Nz([JobTdExtra],0))))))) - Sum((IIf([fkAccountTypeID]=1,[JobTdFare],0)*[JobCom])+(IIf([fkAccountTypeID]=2,[JobTdFare],0)*[JobCom]))
 
yes, that seems to work.. thank you bob.. you have shown me the light yet again.
 

Users who are viewing this thread

Back
Top Bottom