A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

IIF statement pulling from wrong field



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2010, 04:52 PM posted to microsoft.public.access.queries
jligue via AccessMonster.com
external usenet poster
 
Posts: 6
Default IIF statement pulling from wrong field

I have a query have has the 5 variations of the following IIF statement: Bag
Total: IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null) this
statement says to add up if the unit of measure if it is a bag.
I am attempting to add another IIF statement that says =Sum(IIf([product type]
Like "*printed*", [pounds], 0)) - I am trying to add up if the product type
has the word printed in it total it at each customer and at the end of the
report.
When I use this IIF statement on my report, it is totalling the amount from
the printed IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null)
amount, not the pounds column.

The product type is a text field, the pounds field is a number field.

I need help writing the proper IIF statement, changing the other IIF
statements, or defining how the fields are defined. Thank you.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

  #2  
Old February 19th, 2010, 06:46 PM posted to microsoft.public.access.queries
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default IIF statement pulling from wrong field

see in-line comments
--
Daryl S


"jligue via AccessMonster.com" wrote:

I have a query have has the 5 variations of the following IIF statement: Bag
Total: IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null) this
statement says to add up if the unit of measure if it is a bag.
I am attempting to add another IIF statement that says =Sum(IIf([product type]
Like "*printed*", [pounds], 0)) - I am trying to add up if the product type
has the word printed in it total it at each customer and at the end of the
report.
When I use this IIF statement on my report, it is totalling the amount from
the printed IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null)
amount, not the pounds column.


If you want the pounds column totalled for this, use this:
IIf(" " & [Unit of Measure] & " " Like "* BAG *",[pounds],Null)


The product type is a text field, the pounds field is a number field.

I need help writing the proper IIF statement, changing the other IIF
statements, or defining how the fields are defined. Thank you.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

.

  #3  
Old February 19th, 2010, 07:31 PM posted to microsoft.public.access.queries
jligue via AccessMonster.com
external usenet poster
 
Posts: 6
Default IIF statement pulling from wrong field

It is working, MANY thanks!

Daryl S wrote:
see in-line comments
I have a query have has the 5 variations of the following IIF statement: Bag
Total: IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null) this

[quoted text clipped - 6 lines]
the printed IIf(" " & [Unit of Measure] & " " Like "* BAG *",[Qty],Null)
amount, not the pounds column.


If you want the pounds column totalled for this, use this:
IIf(" " & [Unit of Measure] & " " Like "* BAG *",[pounds],Null)

The product type is a text field, the pounds field is a number field.

I need help writing the proper IIF statement, changing the other IIF
statements, or defining how the fields are defined. Thank you.


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.