Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, I have a derived total field on my form and I need it to turn red if the figure is a minus, black if zero or positive? I have tried using if me.xxx = < 0 then me.xxx.backcolor = yyy etc on the update event of the field from where the derived figure comes from but nothing happens?


    Thanks Darren.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You don't need VBA code.
    Open the form in design view.
    Select the text box.
    Set the Fore Color (i.e. the text color) to black.
    Select Format | Conditional Formatting...
    Leave the first dropdown to the default "Field Value Is".
    Select "less than" from the second dropdown.
    Enter 0 in the box next to it.
    Select Red from the Font/Fore Color dropdown.
    Click OK.

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans, I was unware of this though it isn't behaving how I want. My default confdition is black text and white fore. If greater than zero I want red background and if less than zero, black. I have set conditions 1 and 2 to reflect this. Only red is shown when actioned though for both plus and minus figures. Incidentally the type is currency.


    Thanks, Darren.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Your description is confusing. Fore color = text color and Back color = background color, so "black text and white fore" is contradictory.

    Moreover, originally you stated that you wanted "red if the figure is a minus", now "If greater than zero I want red background".

    Please describe precisely and unambiguously what you want.

  5. #5
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Hans, sorry for confusion, here goes: zero is my default with white background and standard black text, if the figure is positive I need red background and black text, if the figure is negative I need black background with white text. The formatting doesn't seen to recognise the minus figures, I have tried with other positive ranges and it works fine. Clearly I am doing something wrong.


    Thanks.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    There appears to be a problem with conditional formatting - I can't get it to work correctly this way either. Try the following:
    - Select Expression Is in the first dropdown for the second condition (the one for negative numbers).
    - The second dropdown will automatically disappear.
    - Enter the expression [FieldName]<0 in the box next to the dropdown, where FieldName is the name of the field/text box.

  7. #7
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for this Hans.

    Darren.

Posting Permissions

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