Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Unanswered: Conditional Formatting

    I have a form with two fields 'D_KS4Targ' and 'D_TA1' which contain examination grades (UK grading system: A*, A, B, C, D, E, F, G, U) I want to format the 'D_TA1' control so that if its grade is lower than the 'D_KS4Targ' grade then the control back colour is red but if it is higher then the back colour is green, and if the grades are the same the back colour is to stay white. I have come up with the following expressions used in the conditional formatting window which mostly work, the problem occurs with the A* and A grades as the * is being classed as a wildcard. Any ideas on how to modify the expressions to get around this.

    Condition 1
    expression is: ([D_TA1]="A*" And [D_KS4Targ]="A") Or [D_TA1]<[D_KS4Targ]
    Back Colour set to Green

    Condition 2
    Expression is: ([D_TA1]="A" And [D_KS4Targ]="A*") Or [D_TA1]>[D_KS4Targ]
    Back Colour set to Red

    Example results
    D_KS4Targ / D_TA1
    C / D = Red (Correct)
    D / C = Green (Correct)
    D / A = Green (Correct)
    A / D = Red (Correct)
    A* / B = Red (Correct)
    A* / A = Green (Should be Red)
    A / A* = Green (Correct)
    A / B = Red (Correct)
    C / C = White (Correct)

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    ditch the conditional formatting
    place your formatting code in a function, call that function in the forms on current event and controls containing your data on change events

    in your function place code equivalent to your conditions
    ir could be a nested select case or a series of if then statements

    set the colour using
    mycontrol.<propertyto change>=newvalue
    you can chaneg the colours (fore & back) text weight etc - effectively anything you can do in a conditional format and more (you can change multiple controls properties). The one observation I'd make is to make sure that you include an else satement to reet the values to the default or base values.

Posting Permissions

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