Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78

    Unanswered: IIF Statement in Query

    Im trying to make my query use an IIF statement but it isn't quite working as I'd hoped. In my table, each record has a value in the last column that will either be "HA" or "HM". Im my query I am trying to make it look at a value on a form and if the value is False then show only "HM" records. If it is True then display "HM" and "HA" records.

    I can get the False part to work but the true bit says it is too complex. My current code that does not work is displayed below.

    Code:
    IIf([forms]![fmHAMain]![txtaccessboth]="False","HM","HM" Or "HA")
    Can you help?

    Thanks

    Neil.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Perhaps:
    Code:
    ....
    WHERE MyField LIKE 
    
    IIf([forms]![fmHAMain]![txtaccessboth]="False","HM","*")
    EDIT - corrected SQL
    Last edited by pootle flump; 09-05-06 at 09:00.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2002
    Posts
    108
    IIf([forms]![fmHAMain]![txtaccessboth]="False","HM","HM" Or "HA")

    Try it without the quotes around False

  4. #4
    Join Date
    Sep 2003
    Location
    Hertfordshire, England
    Posts
    78
    Thanks Flump that worked.

    Neil.

Posting Permissions

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