Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

problem with criteria

Discussion in 'Information Technology' started by Nathan, Jul 28, 2006.

  1. Nathan

    Nathan
    Expand Collapse
    Guest

    I want to use an iif statement in the criteria for a query, but when "false"
    I would like it to display all records.
    Something like this is what makes sense to me.

    iif(x>y,x,like *)

    where it would filter to the value x when true, but would return all records
    when false.

    This does not work for me, at least with the number fields I'm trying to
    work with. Nor does "x or y or z" despite that exact text working outside of
    an iif statement. Is there a way to do this?

    Thanks Nathan
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News Sikhs Face Problems While Carrying Kirpans In Khyber-Pakhtunkhwa - SikhSiyasat.Net Breaking News Jul 29, 2016
    "Dasam" Granth - A Look At The Core Problems Dasam Granth Oct 21, 2015
    Problems In Life Sikh Sikhi Sikhism Apr 13, 2015
    How can I make decent and useful friends and from where ?? most people have a problem with me Sikh Youth Oct 23, 2013
    The Problem with Taking Too Many Vitamins Health & Nutrition Oct 18, 2013

  3. KARL DEWEY

    KARL DEWEY
    Expand Collapse
    Guest

    Try this --
    Like iif(x>y,x, "*")

    "Nathan" wrote:

    > I want to use an iif statement in the criteria for a query, but when "false"
    > I would like it to display all records.
    > Something like this is what makes sense to me.
    >
    > iif(x>y,x,like *)
    >
    > where it would filter to the value x when true, but would return all records
    > when false.
    >
    > This does not work for me, at least with the number fields I'm trying to
    > work with. Nor does "x or y or z" despite that exact text working outside of
    > an iif statement. Is there a way to do this?
    >
    > Thanks Nathan
    >
    >
     
  4. Wolfgang Kais

    Wolfgang Kais
    Expand Collapse
    Guest

    Hello Nathan.

    Nathan wrote:
    > I want to use an iif statement in the criteria for a query, but when
    > "false" I would like it to display all records.
    > Something like this is what makes sense to me.
    >
    > iif(x>y,x,like *)
    >
    > where it would filter to the value x when true, but would return all
    > records when false.
    >
    > This does not work for me, at least with the number fields I'm
    > trying to work with. Nor does "x or y or z" despite that exact text
    > working outside of an iif statement. Is there a way to do this?


    Sure. Your criteria can be translated to a logical expression without
    the iif function (let's say your column is named c): c = x or x <= y.
    Maybe this helps in building the criteria.

    When "x or y or z" is displayed as criterion for the column c in query
    design view, it means "c = x or c=y or c=z". When used elsewhere, for
    example as an argument of the iif function, "x or y or z" evaluates to
    true if at least one of x, y and z is true, regardless of column c.

    --
    Regards,
    Wolfgang
     

Share This Page