Results 1 to 4 of 4
  1. #1
    jmk909er is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Location
    San Diego, CA
    Posts
    39

    Iff statenent in conditional formatting


    Can someone help me out with these IIf statements below? I need the days to be >= and <= so that I don't have gaps. when I try to enter it that way I get "The expression you entered has invalid syntax"
    This is for conditional formatting to change the back color of a text box. Maybe the word And is messing me up or I need additional parenthesis?? Thanks, Joe

    IIf(Now()-[Forms]![frmIntro]![Data Changed]>20,True,False)
    IIf(Now()-[Forms]![frmIntro]![Data Changed] Between 14 And 19,True,False)
    IIf(Now()-[Forms]![frmIntro]![Data Changed] Between 6 And 13,True,False)

  2. #2
    LillMcGill is offline Dagny fan
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Location
    Southern USA
    Posts
    70
    You just need to enter the statements wherein the format should be turned on. No IIF here.
    Now()-[Forms]![frmIntro]![Data Changed]>20
    or even use
    Now()-[Data Changed]>20

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Also, this may be one of those places where Between won't work. If so, you'd need >= And <=. You don't actually need it anyway, as you can rely on the fact that Access will evaluate the expressions in order, so your 3 tests are:

    Blah > 20
    Blah > 13
    Blah > 5

    By the way, you probably want to use Date() rather than Now(), as your existing test could have a decimal remainder that could leaving it failing all tests (like 13.5).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    jmk909er is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Location
    San Diego, CA
    Posts
    39
    Thanks Lil,and Paul I did it the way you suggested and it is working great. Much simpler and cleaner. I guess I was over thinking it. -Joe

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

Similar Threads

  1. Conditional Formatting
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 09:31 PM
  2. conditional formatting right(..)
    By bbeernaert in forum Access
    Replies: 3
    Last Post: 08-25-2010, 12:33 AM
  3. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM
  4. Conditional Formatting
    By cevatyildiz in forum Forms
    Replies: 8
    Last Post: 04-30-2010, 12:01 PM
  5. Conditional formatting
    By ylivne in forum Reports
    Replies: 1
    Last Post: 07-12-2009, 06:18 PM

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