How do I return a blank in a IF formula?

  • Thread starter Thread starter Jeff Kaufman
  • Start date Start date
J

Jeff Kaufman

I am currently using Access 2003 and am having trouble getting my formula to
return the results I would like. I would like for when S_Time is = 0 that my
result return a blank instead of returning a 0... I can't figure out how to
return a blank

SQL formula

IIf([S_Time]=0,0,([O_Time]/[S_Time])*100) AS [Open%]
 
Where are you trying to do this: in a query, as a ControlSource for a
control. or somewhere else?

If it's in a query, you won't be able to return blank for a numeric field:
blanks aren't numeric. You can try using Null (no quotes) instead of 0.

As a control source, you should be able to put "" or " " instead of the 0
(although Null will work as well).
 
IIf([S_Time]=0,Null,([O_Time]/[S_Time])*100) AS [Open%]

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Back
Top