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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If Qty = 0...



 
 
Thread Tools Display Modes
  #1  
Old July 17th, 2007, 03:55 PM posted to microsoft.public.access.reports
stephendeloach via AccessMonster.com
external usenet poster
 
Posts: 148
Default If Qty = 0...

In my report I have a Quantity, UnitPrice, and NetAmount. Is there a way I
can have it formatted to something like this.. If Quantity = 0, the NetAmount
= UnitPrice ?

Also, I have a Descriptions field, is there a way I can have the Quantity,
Unitprice, and Netamount BLANK if there is nothing entered in them? So it
dosent look like this..

Qty. Desc. UP NA
0 Example 0 $0.00

i want it to look like this...

Qty. Desc. UP NA
Example


thanks.

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

  #2  
Old July 17th, 2007, 05:09 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default If Qty = 0...

stephendeloach via AccessMonster.com wrote:

In my report I have a Quantity, UnitPrice, and NetAmount. Is there a way I
can have it formatted to something like this.. If Quantity = 0, the NetAmount
= UnitPrice ?

Also, I have a Descriptions field, is there a way I can have the Quantity,
Unitprice, and Netamount BLANK if there is nothing entered in them? So it
dosent look like this..

Qty. Desc. UP NA
0 Example 0 $0.00

i want it to look like this...

Qty. Desc. UP NA
Example



You can make a text box display blank instead of 0 by using
a custom format. For example, the Qty an Up text boxes
could use the custom format:
0;-0;""
and the NA text box:
$#,##0.00;($#,##0.00);""

--
Marsh
MVP [MS Access]
  #3  
Old July 17th, 2007, 07:23 PM posted to microsoft.public.access.reports
stephendeloach via AccessMonster.com
external usenet poster
 
Posts: 148
Default If Qty = 0...

Works perfect! Any suggestion on the first question? Thanks!

Marshall Barton wrote:
In my report I have a Quantity, UnitPrice, and NetAmount. Is there a way I
can have it formatted to something like this.. If Quantity = 0, the NetAmount

[quoted text clipped - 11 lines]
Qty. Desc. UP NA
Example


You can make a text box display blank instead of 0 by using
a custom format. For example, the Qty an Up text boxes
could use the custom format:
0;-0;""
and the NA text box:
$#,##0.00;($#,##0.00);""


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

  #4  
Old July 17th, 2007, 08:08 PM posted to microsoft.public.access.reports
Klatuu
external usenet poster
 
Posts: 7,074
Default If Qty = 0...

Make this the control source for the NA control:
=IIf([Quantity] = 0,[UnitPrice],[NetAmount])
--
Dave Hargis, Microsoft Access MVP


"stephendeloach via AccessMonster.com" wrote:

Works perfect! Any suggestion on the first question? Thanks!

Marshall Barton wrote:
In my report I have a Quantity, UnitPrice, and NetAmount. Is there a way I
can have it formatted to something like this.. If Quantity = 0, the NetAmount

[quoted text clipped - 11 lines]
Qty. Desc. UP NA
Example


You can make a text box display blank instead of 0 by using
a custom format. For example, the Qty an Up text boxes
could use the custom format:
0;-0;""
and the NA text box:
$#,##0.00;($#,##0.00);""


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


  #5  
Old July 17th, 2007, 09:15 PM posted to microsoft.public.access.reports
stephendeloach via AccessMonster.com
external usenet poster
 
Posts: 148
Default If Qty = 0...

that works but my control source for NA is =Nz([Quantity]*[unitprice],0)
already. So when I enter =IIf([Quantity] = 0,[UnitPrice],[NetAmount]) it
dosent come up with the right NA when there is say a 6 in the unitprice...

Klatuu wrote:
Make this the control source for the NA control:
=IIf([Quantity] = 0,[UnitPrice],[NetAmount])
Works perfect! Any suggestion on the first question? Thanks!

[quoted text clipped - 10 lines]
and the NA text box:
$#,##0.00;($#,##0.00);""


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200707/1

  #6  
Old July 17th, 2007, 09:38 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default If Qty = 0...

stephendeloach via AccessMonster.com wrote:

Works perfect! Any suggestion on the first question?



I missed that as a separate question. Now that I reread it,
I don't understand what you want ;-\

Did Klatuu figure it out for you?

--
Marsh
MVP [MS Access]
  #7  
Old July 17th, 2007, 09:44 PM posted to microsoft.public.access.reports
Klatuu
external usenet poster
 
Posts: 7,074
Default If Qty = 0...

Aha! ask half a question, get half an answer

=IIf(Nz([Quantity],0) = 0,[UnitPrice],Nz([Quantity],0)*Nz([unitprice],0))

Note about the Nz function:
The way you had it coded would not work correctly. The value has to be
converted before you use it in a calculation. The way is was coded, would,
if Quantity were Null Actually end up as
Null * Unit Price - Which would return Null
Then the Nz function would return 0.
So anytime you hit a Null value in quantity, the result of the calculation
would be 0.
--
Dave Hargis, Microsoft Access MVP


"stephendeloach via AccessMonster.com" wrote:

that works but my control source for NA is =Nz([Quantity]*[unitprice],0)
already. So when I enter =IIf([Quantity] = 0,[UnitPrice],[NetAmount]) it
dosent come up with the right NA when there is say a 6 in the unitprice...

Klatuu wrote:
Make this the control source for the NA control:
=IIf([Quantity] = 0,[UnitPrice],[NetAmount])
Works perfect! Any suggestion on the first question? Thanks!

[quoted text clipped - 10 lines]
and the NA text box:
$#,##0.00;($#,##0.00);""


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200707/1


  #8  
Old July 17th, 2007, 09:46 PM posted to microsoft.public.access.reports
stephendeloach via AccessMonster.com
external usenet poster
 
Posts: 148
Default If Qty = 0...

Yes it worked when there is a 0 as the Quantity, but when there is any other
number it dosent...

Marshall Barton wrote:
Works perfect! Any suggestion on the first question?


I missed that as a separate question. Now that I reread it,
I don't understand what you want ;-\

Did Klatuu figure it out for you?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200707/1

  #9  
Old July 17th, 2007, 10:09 PM posted to microsoft.public.access.reports
stephendeloach via AccessMonster.com
external usenet poster
 
Posts: 148
Default If Qty = 0...

Worked! Now.. I have another question... On my report in my report footer I
have a Non-Taxable, Taxable, Subtotal, Tax, and Total.. My net amount isnt
being added in now.. Here are my formulas for each..

Non-Taxable =Sum(IIf([taxablechk]=False,[Quantity]*[unitprice],0))

Taxable =Sum(IIf([taxablechk]=True,[Quantity]*[unitprice],0))

Subtotal =Sum(IIf([taxablechk]=False,[Quantity]*[unitprice],0))+Sum(IIf(
[taxablechk]=True,[Quantity]*[unitprice],0))

Tax =Sum(IIf([taxablechk]=True,[Quantity]*[unitprice],0))*[Tax]

Total =Sum(IIf([taxablechk]=False,[Quantity]*[unitprice],0))+Sum(IIf(
[taxablechk]=True,[Quantity]*[unitprice],0))+Sum(IIf([taxablechk]=True,
[Quantity]*[unitprice],0))*[Tax]

[taxablechk] is a check box in the form that when checked it adds the [tax]

i hope i included everything that is needed. thanks for the help!

Klatuu wrote:
Aha! ask half a question, get half an answer

=IIf(Nz([Quantity],0) = 0,[UnitPrice],Nz([Quantity],0)*Nz([unitprice],0))

Note about the Nz function:
The way you had it coded would not work correctly. The value has to be
converted before you use it in a calculation. The way is was coded, would,
if Quantity were Null Actually end up as
Null * Unit Price - Which would return Null
Then the Nz function would return 0.
So anytime you hit a Null value in quantity, the result of the calculation
would be 0.
that works but my control source for NA is =Nz([Quantity]*[unitprice],0)
already. So when I enter =IIf([Quantity] = 0,[UnitPrice],[NetAmount]) it

[quoted text clipped - 7 lines]
and the NA text box:
$#,##0.00;($#,##0.00);""


--
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 06:49 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.