Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Jul 2003
    Location
    Notre Dame, Indiana, USA
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access query (2003)

    I have another Access query "IIF statement" quandry.

    Here's the expression I want to use:
    TONS: IIF ([PaperWt]="27.7lb",([ConvTotalRun]/109.68)),IIF ([PaperWt]="30lb",([ConvTotalRun]/101.27)),IIF ([PaperWt]="45lb",([ConvTotalRun]/74.23))

    Is there a way to make this work? I'm getting an error message that says, "The expression you entered contains invalid syntax, or you need to enclose your text data in quotes. You may have entered an invalid comma or omitted quotation marks."

    Thanks,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Access query (2003)

    You could try this:
    <code>
    TONS: IIf([PaperWt]="27.7lb",[ConvTotalRun]/109.68,IIf([PaperWt]="30lb",[ConvTotalRun]/101.27,IIf([PaperWt]="45lb",[ConvTotalRun]/74.23,Null)))
    </code>
    Note that there is no closing parenthesis after the value-if-true, but there is a series of closing parentheses at the end of the expression (one for each IIf function).
    I added Null as value to return if PaperWt is neither 27.7 lb, 30 lb, or 45 lb.

Posting Permissions

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