Results 1 to 9 of 9
  1. #1
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659

    Question Quasi condition formatting with background color

    Is there a way to change the background color of an object on a continuous form? I would like to have the back color of the form change per the data that is in a bound field.

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    You want to change the backcolor of form Detail section?

    Use code. I expect VBA can do it, like:

    Me.Detail0.Backcolor = vbred
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    This works, but it sets the back color for all the forms in continuous form. I am looking to achieve similar to conditional formatting in excel, for record background color.

    Only thing I could think of currently would be to load a BITMAP and have it be set to the back of the form. then have different bitmaps for each color.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    There isn't any 'record background' except for the AlternateBackColor property of Detail section and this cannot be effectively programmed conditionally in Continuous or Datasheet view. Have to use Conditional formatting for each control.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Alright, I will check that out

  6. #6
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    It sounds like you want conditional formatting for record rows. If so, the alternate row colour will not be what you want. How about a textbox control that spans the width of your form (or just the controls you want to highlight) that is positioned behind the data controls, whose properties you set in code depending on the condition? I have done something like this to show the logged in user control as yellow, just not for an entire row. You could play with the properties of the control as well (raised, sunken, bordered) to present some unique effects.

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Micron's suggestion is the standard workaround for this kind of thing. You'll have to add a Field to your underlying Table to use as the Control Source for the Textbox, of course, otherwise, once again, the Control on all Records would be formatted as the Current Record dictates.

    Once the Textbox has been created, you'll need set it Locked Property to Yes and Enabled Property to No; this is necessary to keep the cursor from tabbing into the Textbox.

    In a Single View Form you could use code to set the Formatting, but in a Continuous View Form you'll then need to use Conditional Formatting, off the Ribbon, to set the Conditions/Back Colors as you want, probably using the Expression Is under the Condition dropdown.

    Linq ;0)>

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Actually, the control does not have to be bound to a field. Just tested.

    The Conditional Formatting for all records is NOT dictated by the current record - that's the whole point of Conditional Formatting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You're right, of course...need to adjust my medication!

    Linq ;0)>

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

Similar Threads

  1. Conditional background color
    By aaslezak in forum Reports
    Replies: 5
    Last Post: 05-11-2015, 03:09 PM
  2. Replies: 16
    Last Post: 12-02-2013, 06:20 AM
  3. condition background color of report body
    By focosi in forum Reports
    Replies: 2
    Last Post: 09-24-2011, 11:12 AM
  4. Background Color
    By Meccer in forum Access
    Replies: 4
    Last Post: 05-30-2011, 06:49 AM
  5. Replies: 1
    Last Post: 12-14-2010, 10:03 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