Results 1 to 11 of 11
  1. #1
    SobJim is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14

    IIF statement Help

    Hey All,

    Not sure how to finish this:
    I need to it Subtract 3/7/2013[Code Date] from 04/19/2012[Min/Max] if [INC/Var]="*M*" and if [Inc/Var]="*V" I need the equation reversed.

    Date Variance: IFF([Inc/Var]="*M*", ([Code Date]-[Max/Min])



    Thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are there more than these two values in [Inc/Var]?

  3. #3
    SobJim is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    No, only "V" and "M".

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Date Variance: IFF([Inc/Var]="*M*", [Code Date]-[Max/Min], [Max/Min]-[Code Date])

  5. #5
    SobJim is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    It is applying the False result to the whole column.
    Thanks

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Meaning that the field [Inc/Var] is never equal to the string "*M*"! Is that true?

  7. #7
    SobJim is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    Yeah guess so.

    In the field [Inc/Var] all there is, are spaces and then either an "M" or "V".

    For the Criteria on [Inc/Var] I have it set to Like "*M*" Or "*V". To omit some other lines I don't need.

  8. #8
    SobJim is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    The column has "M"s in them. I have a feeling its the spaces in front of the M or V causing the issue. The Table is imported from a TXT file, is there a way I can have it remove the spaces automatically?

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Date Variance: IFF(InStr([Inc/Var],"M"), [Code Date]-[Max/Min], [Max/Min]-[Code Date])

  10. #10
    SobJim is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    Thanks!!!! That did it!!

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're welcome.

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

Similar Threads

  1. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  2. if-then statement in vba
    By rivereridanus in forum Programming
    Replies: 3
    Last Post: 07-07-2011, 02:11 PM
  3. iff Statement
    By tkandy in forum Access
    Replies: 0
    Last Post: 03-20-2011, 02:31 PM
  4. Help with IF statement
    By mkallover in forum Programming
    Replies: 7
    Last Post: 01-04-2011, 04:47 PM
  5. Help with Iif statement
    By tmcrouse in forum Queries
    Replies: 2
    Last Post: 09-02-2010, 09:00 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