1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: how do I write an expression for conditional formatting

Discussion in 'Business Applications' started by 109boW, Nov 2, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. 109boW

    109boW Thread Starter

    Joined:
    Oct 3, 2007
    Messages:
    52
    how do I write an expression ti conditionally format a report field, called Copy of New report.
    In the field Dia @ last turn, If any of 30A,30B,30C,30D=<720 then highlight the value in red and if either of 40A,41D=<730 then highlight the value in red

    Thanks
    Ben:confused:
     

    Attached Files:

  2. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    Well, I just spent two hours scribbling code trying to make it work, but keep getting errors - looking forward to seeing this one!!! :p
     
  3. 109boW

    109boW Thread Starter

    Joined:
    Oct 3, 2007
    Messages:
    52
    thanks for trying
     
  4. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    LOL - well, what else am I going to do at 3 in the morning? Sleep?
    I can get one condition or the other to work, just not both.
     
  5. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    slurpee, can you post your copy please, I can't Unzip 109's?
     
  6. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    It would appear he used 7-Zip - at least, that opened it for me. :)
     

    Attached Files:

  7. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    slurpee, thanks, I am doing a background virus scan and that may be blocking it.
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    slurpee, thanks, I am doing a background virus scan and that may be blocking it.

    No yours opens OK!
     
  9. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    109, can you clarify for me, if any of the 30s are = to or less than 720, do you want to highlight just that one Value or all of the values in the 30s?
     
  10. 109boW

    109boW Thread Starter

    Joined:
    Oct 3, 2007
    Messages:
    52
    yes, if any 30's or 31's are =<720 highlight just the Dia value
     
  11. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Try this.
     

    Attached Files:

  12. 109boW

    109boW Thread Starter

    Joined:
    Oct 3, 2007
    Messages:
    52
    I'm not sure how you've done it, but seems to be along the right lines. Is it possible to highlight the font rather than the field its self.
    Just to complicate things, in the report Positions, if a position 30A,30B,30C,30D,40B,40C,40D,41A,41B,41C,31A,31B,31C,31D =<720 the font should be highlighted red AND if a position 40A,41D =<730 the font should be highlighted red.
    Hope this clarifies
    Thanks
    Ben
     
  13. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    It was done using VBA in the "On Format" event procedure of the "Details" section of the Report.
    I will look at changing it to suit you requirements.
     
  14. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    OBP, if you are busy, I see how to do it (and using ForeColor instead of BackColor)
     
  15. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    slurpee, it actually simplifies the code change it to

    Dim red As Long, yellow As Long, green As Long, black As Long, grey As Long
    red = RGB(255, 0, 0)
    yellow = RGB(255, 255, 0)
    green = RGB(0, 255, 0)
    black = RGB(0, 0, 0)
    grey = RGB(180, 180, 180)
    If Me.Text24 <= 720 Then
    Me.Text24.ForeColor = red
    Else
    Me.Text24.ForeColor = black
    End If

    If Me.Unitset = "40A" And Me.Text24 <= 730 Then Me.Text24.ForeColor = red
    If Me.Unitset = "41D" And Me.Text24 <= 730 Then Me.Text24.ForeColor = red
     

    Attached Files:

  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Solved write expression
  1. pdevoid
    Replies:
    0
    Views:
    347
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/647018

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice