Results 1 to 3 of 3
  1. #1
    Brian Collins is offline Novice
    Windows Vista Access 2000
    Join Date
    Oct 2010
    Posts
    8

    Nested IIF problems

    I am trying to assign a transaction type to a field.
    There are six types - number 1 to 6
    I have a nested IIF statement as follows



    Automatrix:
    IIf([T01_globalFinancial]![CMS REF]="0Z1037.00472",1,

    IIf([T01_globalFinancial]![CMS REF]="0z1037.00672" And [T01_globalFinancial]![Costs to Date (VAT INCL)]>=0,2,

    IIf([T01_globalFinancial]![CMS REF]="0z1037.00673" And [T01_globalFinancial]![Costs to Date (VAT INCL)]>=0,3,

    IIf([T01_globalFinancial]![CMS REF]="0z1037.00672" And [T01_globalFinancial]![Costs to Date (VAT INCL)]="£0.00",4,

    IIf([T01_globalFinancial]![CMS REF]="0z1037.00673" And [T01_globalFinancial]![Costs to Date (VAT INCL)]="£0.00",5,6)))))

    Condition 1 2 3 and 6 work fine.

    Currently there are no records meeting condition 4 but I am assuming it have the same problem as condition 5

    Condition 5 gives me condition 3.

    The Costs to Date field is set to currency and field contents are set to £0.00.

    I have tried using 0, null, <=1 but the result is the same.

    The IIF statements are split out for ease of reading.

    Any ideas please?

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Obviously, records matching condition 5 must match condition 3, since condition 3 is in prior to condition 5, you get only 3.

    And, when I compared a currency field with a string ( e.g. [T01_globalFinancial]![Costs to Date (VAT INCL)]="£0.00",) in my access 2003, I got type mismatch error.

  3. #3
    Brian Collins is offline Novice
    Windows Vista Access 2000
    Join Date
    Oct 2010
    Posts
    8
    Doh!!! what a numpty

    Problem lies in the >=0

    Which, as you say, is the same condition for 4 and 5.

    Problem solved.

    Tks chum

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Nested Iif statement help
    By Goodge12 in forum Queries
    Replies: 6
    Last Post: 09-21-2010, 11:45 AM
  2. Nested IIF statements?
    By laavista in forum Access
    Replies: 9
    Last Post: 06-22-2010, 10:35 AM
  3. Nested If Expressions
    By Lynn in forum Forms
    Replies: 5
    Last Post: 03-25-2010, 10:11 AM
  4. nested if statement with two criteria
    By kendra in forum Queries
    Replies: 5
    Last Post: 06-16-2009, 04:07 PM
  5. Nested Joins
    By zephaneas in forum Programming
    Replies: 0
    Last Post: 11-10-2008, 11:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums