Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    IF / Than in query using 'Between' (2002)

    Hi,

    Is is possible to write an if / than statement in a query using "between" and if so, what am I doing wrong? I have the following statment in a query but keep getting the message that I may have entered a comma without a preceding value or identifier. I'm not sure what I'm doing wrong:

    ICD 9 IDLink: IIf([icd9 3 digit]>0 or <140,"1","")

    Thanks,
    Leesha

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

    Re: IF / Than in query using 'Between' (2002)

    I think you want And instead of Or, for "> 0 or < 140" is always true. And you must repeat the field name. Try
    <code>
    ICD 9 IDLink: IIf([icd9 3 digit]>0 And [icd9 3 digit]<140,"1","")
    </code>
    You can also use Between, but you must take into account that Between includes both the lower and upper bound, so you should use
    <code>
    ICD 9 IDLink: IIf([icd9 3 digit] Between 1 And 139,"1","")</code>

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: IF / Than in query using 'Between' (2002)

    Thanks Hans! I ended using the "between" as it was less typing.

    Leesha

Posting Permissions

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