Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nested If Statement (03)

    I have a challenge with a nested if statement within an expression:

    Expr1: IIf([MyField]>=1000 And [MyField]<=1010,1015,IIf([MyField]>=1030 And [MyField]<=1040,1045,"Not Assigned"))

    I receive the following message when trying to execute the query. As far as I can tell it should work.

    Thanks for your assistance,
    John
    Attached Images Attached Images

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

    Re: Nested If Statement (03)

    You are mixing numeric results (1015, 1045) and a string result ("Not Assigned"). Try putting quotes around 1015 and 1045.

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Nested If Statement (03)

    Hans,

    Your suggestion worked. I would have thought the nested if statement would have been similar to Excel.

    Regards,
    John

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

    Re: Nested If Statement (03)

    Access is much stricter than Excel - a field/column can contain only a single data type.

Posting Permissions

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