Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    19

    Unanswered: Conditional Format Limits

    Hello all

    As you can see in attached file, I'm using conditional format to change colors in these rows, formating is done by type(if comercial then yellow, if supplies then green, if technical then blue, if collection then orange). So far so good.

    Now I need to add another type. I'm stuck with 4 conditions limit of conditional format.

    Can anyone help me??

    Thanks in advance


    att. last column uses different conditions.
    Attached Thumbnails Attached Thumbnails untitled2.JPG   untitled.JPG  

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Conditional Formatting

    You could try doing this through code setting the colors on an After_Update or on the On_Current form properties. This is the way we handled criteria which exceeded the Conditional Formatting capabilities. You could have a "Lookup" table with the values in one field and the color settings in another field.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so don't use conditional formatting....

    if you place some code in the report detail "on format event" you can change any element of the report detail
    you can change the background colour, foreground colour, boreder colour & size, fonts, font sizes etc.... I would be carefull at getting too carried away with setting to much as it can get to be an eysesore on the report. It also means that you have to use a colour printer.

    the code is soemthing like
    if <condition>=true then
    <control>.<item>=<setting>
    <control1>.<item>=<setting>
    <control2>.<item>=<setting>
    ...etc (you could set multiple settings for the same control, you could set multiple controls in one pass)
    elseif
    <as many elseifs as required
    else
    <control>.<item>=<defaultsetting>
    endif
    the alternative is to set the setting
    eg
    if <condition> then
    backgroundcolour=<coloursetting>
    foregroundcolour=<coloursetting>
    fontsize=......
    elseif condition
    backgroundcolour=<coloursetting>
    foregroundcolour=<coloursetting>
    fontsize=......
    else
    backgroundcolour=<coloursetting>
    foregroundcolour=<coloursetting>
    fontsize=......
    endif
    control.backcolor=backgroundcolour
    .....

    the last bit is important, as otherwise the previous setting would be carried forward.

    you could pull the required setting from a table, say if you had a table that had 'technical' and had a colour setting you could pull that setting from the table. So if someone decides they want their report with white text on a redback ground, in place of the black text on a turquoise background you instruct them to open the form and do what they like.

    HTH

  4. #4
    Join Date
    Dec 2003
    Posts
    268

    Code

    This looks like a continuous form.

    At the on current event you could add some code like the following

    dim strColor as string
    dim collControls as collection

    collcontrols.add "Control you want to changebackground for"
    collcontrols.add "Another control like the previous"
    collcontrols.add "yet another control"

    select case Type
    Case "Commercial"
    strcolor = vbYellow
    case "Supplies"
    strcolor = vbGreen
    case "Something else"
    strcolor = vbOtherPertyColor
    case else
    strcolor = vbyourdefaultcolor
    end select

    dim ctl as control


    for each item in collcontrols
    me.controls(item).backcolor = strcolor
    next ctl

    this should work. I didnt' have an example to test it on, but should work.

  5. #5
    Join Date
    Aug 2004
    Posts
    19
    Thanks for the answer.

    Humberto

Posting Permissions

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