Results 1 to 4 of 4
  1. #1
    Tomhoneyman is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    5

    How to Change Background Image / Colour Conditionally

    Hi,



    I want to change the background colour of the detail section within a form but want to change it so that it changes colour conditionally based on what a cell is equal to.

    For example:
    The background changes colour to 'Yellow' if job status = 'Quote'
    The background changes colour to 'Transparent' if job status = 'Won'

    Is there a way of doing this?

    Tom

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    If the job status is in a table (for user selection)
    add field 'color' as long, and set the color value for each 'status'
    then in the Afterupdate event of the combo box,

    me.backcolor = cboBox.column(2)
    (or the column you set color to) be sure to set combo.columns = 2 (or more to include the color)

  3. #3
    Tomhoneyman is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    5
    Yes the job status is chosen from a dropdown list and stored in a table.

    What do you mean by add field 'color' as long, and set the color value for each 'status' How do I do this?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    TABLE:
    status, color
    active, 221544
    inactive,99441

    then integers are color values.
    the combo will have 2 columns, in properties
    then when user picks it...
    Code:
    sub cboBox_afterupdate()
      'NOTE in code column#s start with zero, so col-0 is really the 1st column, col1 is the second one.
      
      me.backcolor = cboBox.column(1)      'but really column2
    end sub

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

Similar Threads

  1. Change Form Background Colour
    By Emma35 in forum Forms
    Replies: 11
    Last Post: 01-25-2016, 06:12 AM
  2. Replies: 3
    Last Post: 10-22-2015, 07:15 AM
  3. Background colour when Form centered
    By jcc285 in forum Forms
    Replies: 4
    Last Post: 03-13-2015, 12:43 PM
  4. subform background colour
    By gbmarlysis in forum Forms
    Replies: 1
    Last Post: 03-03-2012, 10:18 AM
  5. Change the colour of a form background
    By r_e_v_a_n_s in forum Forms
    Replies: 0
    Last Post: 11-15-2005, 03:39 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