IIF Function in query

  • Thread starter Thread starter Fred's
  • Start date Start date
F

Fred's

Hello all,

I have a table which I have the default value 0, If these a way to use
the function "IIF" in query to keep the cell blank when the cell
contain a 0 as the default value? Because, if there is no quanity
entered, I don't want to see the default value in my report

Thanking you for your help!
Fred's
 
That sort of begs the question "Why have a default value if you don't want
it?"

IIf([Field] = 0, Null, [Field])

To remove the unwanted 0s, you can write an Update query:

UPDATE MyTable
SET MyField = Null
WHERE MyField = 0

Of course, what happens if some of the fields should have 0 as their value?
 
Hi

I think it would be

SELECT IIF(tblWhatever.fieldWhatever = 0,"",tblWhatever.fieldWhatever) AS
Whatever
FROM tblWhatever

Just from top of head?
Hope it helps


Fred's said:
Hello all,

I have a table which I have the default value 0, If these a way to use
the function "IIF" in query to keep the cell blank when the cell
contain a 0 as the default value? Because, if there is no quanity
entered, I don't want to see the default value in my report

Thanking you for your help!
Fred's

--
Regan,
Paeroa
World famous in New Zealand

Message posted via AccessMonster.com
 

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

Similar Threads

IIF function alternative 3
IIF statement 5
Aggregate Function Error 0
Multiple iif challenge 2
IIF formula 3
IIf Function 2
IIf return multiple categories 6
Iif function for query 3

Back
Top