Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2004
    Posts
    83

    Unanswered: If statements on reports

    What I would like to do on a textbox in a report is to say...

    IIf([CantLabel]=Yes, [OldName], [NewName])

    So basically, if a Yes/No box is checked it needs to print the text from one field, else print the text from another field.

    I keep getting syntax errors when I try and do this, I'm just wondering if its even possible in a report. I can do this fine in a query, but I can't make a seperate query to run this report.

  2. #2
    Join Date
    Nov 2003
    Location
    Danbury,ct 06801
    Posts
    24
    Yes you can do IFF() in the report .. i do not think u r doing any thing wrong

    just try

    yes = -1
    no = 0

    this r the value for the yes and no .. some time that help 2>>

    hiten
    hbhavsar

  3. #3
    Join Date
    Mar 2004
    Posts
    83
    Seems to be the same deal with a -1, this is the exact error I get

    "Syntax error (comma) in query expression '[IIF([CantLabel]=-1,[OldName],[NewName])"

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    what's with the left bracket before IIF ?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Mar 2004
    Posts
    83
    Thats what I think is causing the problem, however I did not put it there. All I typed is that exact line MINUS the square brackets on either end.

  6. #6
    Join Date
    Jan 2004
    Location
    Vancouver, WA
    Posts
    41
    Try adding an "=" before the IIF...

  7. #7
    Join Date
    Mar 2004
    Posts
    83
    That would be the problem, good call thanks

  8. #8
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Smile

    Hi High D,


    just do this:

    =IIF([CantLabel]=True,"OldName","NewName")

    That's all you need.

    have a nice one,
    Bud

Posting Permissions

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