Results 1 to 5 of 5
  1. #1
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101

    Conditional formatting for a empty field

    I have a combo box1 a/b/c.
    If any of these is selected, combobox2 should get enabled.

    I disabled combobox2 first.
    Then, in conditional formatting, I tried 'Expression is' Not Null (did not work), Not "" (again did not work).
    What is the right rule for this?

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you need something like

    Expression is...not isnull(comboa) or not isnull(combob)

    for combo2 - should be no need to disable it first

  3. #3
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    1)
    Quote Originally Posted by Ajax View Post
    you need something like

    Expression is...not isnull(comboa) or not isnull(combob)
    It is not working. I think I am doing something wrong. It looks like this [combo1]=Not IsNull([combo1]"a") Or Not IsNull([combo1]"b")


    2)
    Quote Originally Posted by Ajax View Post
    for combo2 - should be no need to disable it first
    I don't understand. If combo2 is not disabled in the first place, how can the expression enable it?

    3) What is surprising to me is that even the 'Or' does not work. e.g. [combo1]="a" Or "b" Or "c"

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Interesting... I would have just used VBA to set the Enabled property.

    -----------------------------------------
    Cannot have this....
    [combo1]=Not IsNull([combo1]"a") Or Not IsNull([combo1]"b")
    -----------------------------------------
    This is close but won't work. You have to explicitly compare the values to a control.
    [combo1]="a" Or "b" Or "c"
    like this:
    Code:
    [combo1]="A" Or [combo1]="B" Or [combo1]="C"
    -----------------------------------------
    I did get this to work: In Combo2, set CF to
    Expression is...
    Code:
    [combo1] Is Null Or ([combo1]<>"A" And [combo1]<>"B" And [combo1]<>"C")
    This says:
    If Combo1 is NULL OR Combo1 does not contain "A" or "B" or "C", then disable Combo2

    Combo2 must be enabled


    -----------------------------------------
    If you only have "A", "B" and "C" (and Null) available in Combo1, then in CF for Combo2, you could just use
    Code:
    [combo1] Is Null

  5. #5
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    Awesome!

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

Similar Threads

  1. Conditional Formatting on datetime field
    By Delta729 in forum Access
    Replies: 3
    Last Post: 05-06-2015, 03:37 PM
  2. Conditional Formatting based on another field - Part II
    By Harley Guy in forum Programming
    Replies: 8
    Last Post: 10-17-2013, 12:46 PM
  3. Replies: 5
    Last Post: 10-15-2013, 07:49 AM
  4. Replies: 1
    Last Post: 04-26-2012, 08:31 PM
  5. Replies: 18
    Last Post: 09-30-2011, 06:41 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