By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,508 Members | 2,949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,508 IT Pros & Developers. It's quick & easy.

query criteria

P: n/a
Hi all,

I`m an Access newbie and could use some help here. I`ve made a query
and it works fine. Now I want the query to display the value for a
field only if the value is > 0. I`ve tried inserting
0


into the criteria for the field in the query editor, but this removes
all the records from the query result in which the mentioned field
value is 0. I still want to have the query display the records and all
the values in the other fields - how do I do this?

Jan 13 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
So it's doing what you say you want.

I suspect you're looking for ...
=0
.... as your criteria.
--

Terry Kreft
<ep****@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com... Hi all,

I`m an Access newbie and could use some help here. I`ve made a query
and it works fine. Now I want the query to display the value for a
field only if the value is > 0. I`ve tried inserting
0


into the criteria for the field in the query editor, but this removes
all the records from the query result in which the mentioned field
value is 0. I still want to have the query display the records and all
the values in the other fields - how do I do this?

Jan 13 '06 #2

P: n/a
Thanks for the reply. >=0 is not what I`m looking for here. I want the
field to evaluate to nothing (blank) if the value is 0, is this
possible?

Jan 13 '06 #3

P: n/a
You don't want a criteria then; criteria are used to filter the recordset
not set field values.

In Access you can use the IIF (Immediate IF) statement.

So something like

SELECT
IIf([myfield]>0,[myfield],'') AS Expr1
FROM
mytable;
Change the myfield and mytable labels to match your field and table paste it
into SQL view of a query and see if that gives what you want.

--

Terry Kreft
<ep****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Thanks for the reply. >=0 is not what I`m looking for here. I want the
field to evaluate to nothing (blank) if the value is 0, is this
possible?

Jan 13 '06 #4

P: n/a
Maybe you want this?

In the querygrid type this in a new column:
ValueIfNotZero:IIF([YourField]=0;"";[YourField])

Arno R

<ep****@gmail.com> schreef in bericht news:11**********************@g44g2000cwa.googlegr oups.com...
Thanks for the reply. >=0 is not what I`m looking for here. I want the
field to evaluate to nothing (blank) if the value is 0, is this
possible?

Jan 13 '06 #5

P: n/a
Thanks to both of you. Thats what I needed.

Jan 13 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.