Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    45

    Unanswered: query with iif expression: problem

    Hallo,
    I have a query and I would like to add a criteria that is an iif expression. This iff expression should be something like : if the chekbox in the form is checked than show all the record where this field is = 0; otherwise show all the record where this field is NOT 0.

    The code:

    iif ([Forms]![frm_Org]![chkbox]=No; 0; <>0)

    I tried also NOT 0 instead of <> 0 but it seems that the iff expression and the <> or NOT expression that don't get along well.

  2. #2
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    In the criteria try this:

    IIf([Forms]![Form1]![Check_box1]=True,"A1","<> A1")

    This works if the the form is called form1 and the checkbox is called check_box1.

    Also 'A1' is a value in the query, so A1 can be found...

    Hope it helps.

    Ken

  3. #3
    Join Date
    Feb 2004
    Posts
    142
    You need to try a slightly different angle.

    In the query add a field Expr1: IIf([FieldBeingEvaluated]<>0,-1,0).
    set the show field box off and place the form's checlbox in the criteria section and it or some close variant will work.
    KC

  4. #4
    Join Date
    Feb 2004
    Posts
    45

    Thumbs up

    thanks, the different angle solution worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •