Done to Death

olorin

Registered User.
Local time
Today, 02:48
Joined
Jun 9, 2006
Messages
81
I know Conditional Formatting has been "done to death" on here, but search as I might, I cannot find a solution to my particular problem.
My problem is this;
I have a report that lists (among other things) Products.
There are many products, and I wish to conditionally format the product based on the wether it is right-handed, left-handed, a particular brand, etc, etc,.
The report generates the products from the "tblProducts" and has the primary key as it's bound column.
The Primary keys I wish to format on are;
between 155 and 158, AND 213 and 214 (for left hand customer 1)=(format1)
between 159 and 162, AND 215 and 216 (for right hand customer 1)= (format2)
between 163 and 169, AND 221 and 222 (for left hand customer 2)= (format3)
between 170 and 174, AND 322 and 323 (for right hand customer 2)= (format4)
between 250 and 268 (for customer 3)= (format5)

Naturally, "Conditional Formatting" doesn't accomodate more than 3 conditions, so I thought I would have to do it with VBA.

Any advice would be most appreciated.
 
I don't know if I've understood the challenge 100%, but I think in the On Format event of the detail section, you could try something like this

Code:
select case Me!NameOfYourPrimaryKey
    case 155 to 158, 213, 214
        me.section(acdetail).backcolor = vbred
    case 159 to 162, 215, 216
        me.section(acdetail).backcolor = vbblue
    case 163 to 169, 221, 222
        me.section(acdetail).backcolor = vbgreen
    case 170 to 174, 322, 323 
        me.section(acdetail).backcolor = vbyellow
    case  250, 268
        me.section(acdetail).backcolor = vbmagenta
    case else
        me.section(acdetail).backcolor = vbwhite
end select
This should alter the colours of the detail section. For it to "bleed through" the controls, you may set the controls back style to transparent. You can also alter the colours and other stuff of the controls by for instance something like this

Me!txtField1.BackColor = vbRed
Me!txtField1.ForeColor = vbWhite
Me!txtField1.FontWeight = 750
 
Brilliant! Fandabbydozy! Whoopieee!
Thank you so much for your time and information.
Worked a treat.
Like all things, it's easy when you know how.
Not only have you solved my problem, you have educated me in the use of "Select Case".
Thank you, Thank you, Thank you.
 

Users who are viewing this thread

Back
Top Bottom