By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 2,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Expression in query

P: n/a
fat
Hi
I am trying to calculate Cost times Quanity but i also want to
calculate another field if the cost field is zero i have some thing
wrong, here is my code in the query
IIf([SundrySub]=0,nz([cost],0)*[Quanity]),IIf([SundrySub]>0,nz([Sundry],0)*[Quanity])

Apr 18 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"fat" <sy*********@sybr.com.au> wrote in
news:11**********************@i39g2000cwa.googlegr oups.com:
Hi
I am trying to calculate Cost times Quanity but i also want to
calculate another field if the cost field is zero i have some
thing wrong, here is my code in the query
IIf([SundrySub]=0,nz([cost],0)*[Quanity]),IIf([SundrySub]
0,nz> ([Sundry],0)*[Quanity])

Formatting this gives me

IIf([SundrySub]=0, "the initial test"
nz([cost],0)*[Quanity] "value if test is true"
) "No value if test is false"
, "end of definition of value"
"We need to define this field's name"
Now start a new field definition
IIf([SundrySub]>0, " new test if first test is false"
nz([Sundry],0)*[Quanity] " Calculation for true"
) "No value if test is false"
I don't think this was your intent. Did you want the
value in one field, dependent on the conditions?

Try
..
IIf([SundrySub]=0,
nz([cost],0)*[Quanity],
IIf([SundrySub]>0,
nz([Sundry],0)*[Quanity]
)
)

And please learn how to spell quanTity.
--
Bob Quintal

PA is y I've altered my email address.
Apr 18 '06 #2

P: n/a
fat
Thanks i see i had not placed the ) in the right place, and yes i know
that the spelling was incorrect for Quantity..thanks for your help....

Apr 18 '06 #3

P: n/a
"fat" <sy*********@sybr.com.au> wrote in
news:11*********************@g10g2000cwb.googlegro ups.com:
Thanks i see i had not placed the ) in the right place,
That's the importan part in fixing the problem

and yes i know that the spelling was incorrect for
Quantity..
That's my mother chewing me out, she was an english teacher.

thanks for your help....


You are welcome.
--
Bob Quintal

PA is y I've altered my email address.
Apr 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.