How do I return a blank in a IF formula?

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%]
 
D

Douglas J. Steele

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).
 
J

John Spencer

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
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top