Results 1 to 4 of 4
  1. #1
    Traceyannabanna is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2017
    Posts
    11

    Conditional formatting of a field when another field is=true

    Hi all I have a few fields in my form which are customers personal details (Title, Name, Date of birth etc) I also have a checkbox (Insured) I would like to make all fields (except checkbox) green if the checkbox is ticked. Can anyone help please?

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    In the AfterUpdate Event of the checkbox(Change field names to yours):

    If me.checkbox = True then
    me.Field1.backcolor = vbGreen
    Else
    me.Field1.backcolor = vbWhite
    End If

    Also add the code to the OnCurrent event so as you get to a new record if it is checked, it will display them as green.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    in design view, select all the controls (not fields) you want to be green if insured is true (ticked)

    on the ribbon, select conditional formatting on the format tab. Select new rule then 'check values in the current record....'

    In the format only cells section, select Expression is from the dropdown.

    Then in the expression part put

    [Insured]=true

    and in the preview section select the formatting required

    click OK

    note that [Insured] is the name of your checkbox and needs to be bound to a field in your recordsource. If it is unbound, then it will have the same value in all the records, so all controls will display accordingly

  4. #4
    Traceyannabanna is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2017
    Posts
    11
    Thank you so much. I tried Ajax answer as I am just a novice and it seemed easier. Works brilliantly thanks again

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

Similar Threads

  1. Replies: 1
    Last Post: 01-05-2017, 05:14 PM
  2. Conditional formatting for a empty field
    By Bradex in forum Forms
    Replies: 4
    Last Post: 03-18-2016, 09:11 PM
  3. Conditional Formatting on datetime field
    By Delta729 in forum Access
    Replies: 3
    Last Post: 05-06-2015, 03:37 PM
  4. Conditional Formatting based on another field - Part II
    By Harley Guy in forum Programming
    Replies: 8
    Last Post: 10-17-2013, 12:46 PM
  5. Replies: 5
    Last Post: 10-15-2013, 07: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