• Coloured rows in a form (access 97)

    Author
    Topic
    #392685

    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

    Viewing 1 reply thread
    Author
    Replies
    • #706316

      Access moderator MarkLiquorman 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 SteveH.

      • #706328

        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.

      • #706329

        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.

      • #1132068

        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

        • #1132077

          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.

          • #1132085

            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

            • #1132089

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

    • #706317

      Access moderator MarkLiquorman 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 SteveH.

    Viewing 1 reply thread
    Reply To: Coloured rows in a form (access 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: