Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / January 2006

Tip: Looking for answers? Try searching our database.

query criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
epost2@gmail.com - 13 Jan 2006 10:36 GMT
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?
Terry Kreft - 13 Jan 2006 11:02 GMT
So it's doing what you say you want.

I suspect you're looking for ...
>=0

... as your criteria.

Signature

Terry Kreft

> Hi all,
>
[quoted text clipped - 8 lines]
> 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?
epost2@gmail.com - 13 Jan 2006 11:15 GMT
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?
Terry Kreft - 13 Jan 2006 11:50 GMT
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.

Signature

Terry Kreft

> 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?
Arno R - 13 Jan 2006 12:01 GMT
Maybe you want this?

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

Arno R

> 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?
epost2@gmail.com - 13 Jan 2006 12:21 GMT
Thanks to both of you. Thats what I needed.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.