Results 1 to 14 of 14
  1. #1
    Join Date
    Jul 2011
    Posts
    54

    Unanswered: Highlighted listbox selection colour in reports

    I have a report with a bunch of listboxes that have "Green", "Amber" or "Red" selections.

    They show up highlighted black when selected on the report.

    Is it possible to assign a highlight colour to each of these selections WITHOUT having to write code?

    Thanks heaps

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    consider using conditional formatting
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jul 2011
    Posts
    54
    Quote Originally Posted by healdem View Post
    consider using conditional formatting
    Could you give me some ideas on how to use that in this situation?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jul 2011
    Posts
    54
    what makes you think I would ask a question without searching on Google firsthand?

    and if your going to be a comedian at least use Let me google that for you to do it!

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so what help do you think you need on using conditional formatting that you cannot get from your extensive search of google and elsewhere?
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Jul 2011
    Posts
    54
    Quote Originally Posted by healdem View Post
    so what help do you think you need on using conditional formatting that you cannot get from your extensive search of google and elsewhere?
    I have done extensive search for over an hour.

    I've found nothing.

    It goes over conditional formatting, but since im a newb, I cant adjust it to fit my situation.

    Please help.

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so what have you tried
    have yuou tried to use conditional formatting
    personally I dislike the lack of flexibility conditional formatting imposes on you. but for your purposes it shoudl be fine

    what have you tried
    what has gone wrong
    what steps have you taken to clear the problem

    usually I'd place code behind the reports on format event

    if condition1 = true then
    controla.backcolour = vbred
    elseif condition2 = true then
    control.backcolour = vbcyan
    elseif condition3 = true then
    control.backcolour = vbgreen
    else
    control.backcolour = vbwhite
    endif


    it could also be wrapped up in a select case statement
    I'd rather be riding on the Tiger 800 or the Norton

  9. #9
    Join Date
    Jul 2011
    Posts
    54
    Ok so I'll use code, just tell me where to insert it and how to write the condition plzz

  10. #10
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    at least make the effort matey before requesting help....
    I'd rather be riding on the Tiger 800 or the Norton

  11. #11
    Join Date
    Jul 2011
    Posts
    54
    Ok so conditional formatting cannot be used with listboxes? whenever I select a listbox you cannot select "conditional", whenever I click a textbox you can?

  12. #12
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why are you using list boxes in reports.. that doesn't make much sense as their is no need for such a control in a report as their is no need for a user to make a selection based on a list box.

    the only times I've come across such a design paradigm is when someone has used the bastardisation that MS call a lookup value in a table design which is something that should be avoided at all costs as frankly its crap, causes all manner of problems and is neither and elegant of effective design choice.
    I'd rather be riding on the Tiger 800 or the Norton

  13. #13
    Join Date
    Jul 2011
    Posts
    63
    Quote Originally Posted by healdem View Post
    so what have you tried
    have yuou tried to use conditional formatting
    personally I dislike the lack of flexibility conditional formatting imposes on you. but for your purposes it shoudl be fine

    it could also be wrapped up in a select case statement
    You mention the "lack of flexibility" conditional formatting imposes. Can you elaborate and describe what method you prefer? Thanks!

  14. #14
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    the lack of flexibility is that you are limited (or at least were last time I used CF) to 4 variants, and you couldn't set the same va\lues for multiple controls based on the same rule. So I prefer to do such formatting in code in the relevent control (or forms) on format event.

    the added advantage is that the code is clear to setup, easy to find and easy to read. if you need to apply the similar rule to numerous columns / controls you can easily cut & paste code making the relevant changes easier.

    it also means that when you come to maintain the same report a few years down the line (or you pick up someone else's code its quick and easy to work oput where the rules are. you don't have to go through each and every control to find waht rules have been applied.
    making changes to trigger values is easier AND you can make the rules more complex (ie if control A is in range blah AND control B in range blah-di-blah then do xyz to the following.

    having inherited a horrendous report which had 200+ controls of which 150 or so used CF aall of which had to be changed I vowed never again to use CF in such a manner. if you think the formatting rules are never going to change and there are a limited number of controls then by all means use CF. however Im too long in the tooth to fall for that line. what if some bright spark decides to add another rule, or change the trigger points or decides to change the colours. being a jaded cynic my usual response is to let the user define their colours and their rules, then if they want to change the trigger value to say 20% and have a yellow background with pink text they can have it (and they can do it themselves) by changing data not code. if someone has a specific colour blindness and they cannot persuade others to change colours to meet that colour blindness then the report can be tailored to their requirement. so if they cannot distinguish between red & green then for them the report is say yellow & blue or whatever.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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