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  

Return null (blank) instead of zero



 
 
Thread Tools Display Modes
  #1  
Old May 10th, 2007, 04:32 PM posted to microsoft.public.access.reports
Eastharbour
external usenet poster
 
Posts: 2
Default Return null (blank) instead of zero

I have written an expression using the IIF function. It evaluates two number
fields and performs a calculation. I would like to display null (blank) if
the expression returns a value of zero. Is this possible?
  #2  
Old May 10th, 2007, 05:15 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default Return null (blank) instead of zero

If you want it to display blank then you can use the control's format to set
that.

Set the format as follows
#;-#;"",""

If you want it to BE null then you need to do the calculation and test the
result and then either return Null or the value of the calculation
So if your original IIF is
IIF(AB,A*B,A)
Then it now becomes
IIF( IIF(AB,A*B,A)=0 ,Null, IIF(AB,A*B,A))

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Eastharbour" wrote in message
...
I have written an expression using the IIF function. It evaluates two
number
fields and performs a calculation. I would like to display null (blank)
if
the expression returns a value of zero. Is this possible?



  #3  
Old May 10th, 2007, 05:26 PM posted to microsoft.public.access.reports
Eastharbour
external usenet poster
 
Posts: 2
Default Return null (blank) instead of zero

Adding the variable Null was the solution I needed.

Thanks for your help, Dawn

"John Spencer" wrote:

If you want it to display blank then you can use the control's format to set
that.

Set the format as follows
#;-#;"",""

If you want it to BE null then you need to do the calculation and test the
result and then either return Null or the value of the calculation
So if your original IIF is
IIF(AB,A*B,A)
Then it now becomes
IIF( IIF(AB,A*B,A)=0 ,Null, IIF(AB,A*B,A))

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Eastharbour" wrote in message
...
I have written an expression using the IIF function. It evaluates two
number
fields and performs a calculation. I would like to display null (blank)
if
the expression returns a value of zero. Is this possible?




 




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 09:01 AM.


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