Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Vancouver, BC, Br. Columbia, Canada
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Coloured rows in a form (access 97)

    Dear Woody's marvelous mavens - Does anyone know if its possible to display a form in datasheet or continuous form view with different background colours for each row based on values in the data? e.g. If an amount > X then display this row in red.
    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Coloured rows in a form (access 97)

    Access moderator <!profile=MarkLiquorman>MarkLiquorman<!/profile> has a downloadable demo of this on his website; there is a link in his profile; look for Tips, Links and Downloads, then Highlight a single row.

    I have attached another demo, written by fellow Lounger <!profile=SteveH>SteveH<!/profile>.
    Attached Files Attached Files

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Vancouver, BC, Br. Columbia, Canada
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Coloured rows in a form (access 97)

    Hi Hans - Seems the lounge hardly needs a search engine, at least for Access, as long as you're on the board. Thank you SO much. If you're ever in beautiful Vancouver I'd love to take you for a beer.

  4. #4
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Coloured rows in a form (access 97)

    Hi All,
    I did this on one of my forms a LONG time ago and now I can't remember how to do it! Using the examples, I can't find where they are calling for the colors based on the condition. I am looking at frmProducts_Category2 in the highlight2k db example and can't see where they are changing the color of the line based on value. Please clue me in!

    Thanks,
    Mark

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Coloured rows in a form (access 97)

    There's a series of text boxes txtBackground1 through txtBackground8, each of which fits exactly in the Detail section. These text boxes are stacked on top of each other, and they are placed behind the controls that display data.
    The background style of these text boxes has been set to transparent, and the foreground (text) color to a different pastel color for each text box. The font is set to the System font, an old MS DOS font that contains box characters.
    The control source is of the form =IIf([CategoryID]=1,String(50,Chr(166)),Null) with =1 replaced with =2 etc. for the other text boxes. In this example, if CategoryID, the text box displays a string of 50 box characters Chr(166) in the specified text color, otherwise it is blank. Because the text boxes have a transparent background and the conditions are mutually exclusive, only one text consisting of colored boxes will be visible at a time.
    Before the advent of conditional formatting this was the only way to provide different colors in a continuous form, and it can be used with as many conditions as necessary, instead of just 3 as with conditional formatting.

  6. #6
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Coloured rows in a form (access 97)

    Hi Hans,
    I found the conditional formatting thing but it sounds like the other method you explain below would be more flexible and would also look better. On my form, only the background color of the text box is changing, not the entire background under the boxes. Looking at what you have stated below, I take it that you must create other controls that are behind the text.

    Thanks,
    Mark

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Coloured rows in a form (access 97)

    The method I described uses text boxes that are placed behind the controls that display the data, and that fill the entire detail section.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •