473,473 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Expression in query

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
3 1260
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: | last post by:
I am trying to run the following agregate function in a parameterized query on Access2000: Min(.*sqr(./.)/) The query saved OK, but an attempt to run it results in the message: The expression...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
3
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the...
2
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am...
10
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp "If the value of the variant argument is Null, the Nz function returns the number zero or a...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
10
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone...
28
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
3
by: mbardwel | last post by:
I am building a query in Access 2003. Here is my problem. I create an expression called SUN_ST In a later expression I reference a calculation based on SUN_ST ie, MON_ST=sum-SUN_ST SUN_ST is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.