VB Conditional Formatting

mattloflin

Question Askin Lad
Local time
Today, 05:31
Joined
Dec 22, 2007
Messages
31
I have searched this forum and searched and can't find how to do what i'm about to ask. I have tried different things but none of which seem to work.

Heres the Deal:
1. I have a form that displays results based off a search. I can use the conditional formatting but it limits me to 3. Here is what I need:



If column1 on form1 ="In Production" backcolor = yellow
... "Ready to Ship On Rack" backcolor = pink
... "Print Not Available" backcolor = tan
... "Problems in production" backcolor= red
... "Errors in wiring" backcolor = blue
... "Needs test sheet" backcolor = green

so when the results come up i need the "column1" to be scanned and if it equals one of those criteria then it do it.

2. Will that same code work in the code for a report? I have rptCurrent that is going to be identical to that list in the searched criteria :)

like rptCurrent.column1 = "....." then vbred

if someone could type up a sample of code just like the first 3 criteria i can take it form there. I'm just lost. I have read things about "cases" and elseif and i understand it but i can't apply it.
Thanks in advance!!
 
For your form, see 'Conditional Formatting' of controls in a continuous form

For a report you can use the On Format event in the section where you values are.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.txtColor
Case "Red"
    Me.txtColor.ForeColor = vbRed
Case "Blue"
    Me.txtColor.ForeColor = vbBlue
Case Else 'Default
    Me.txtColor.ForeColor = vbBlack
End Select
End Sub

Hope that helps!
:)
 
I make a calculated field based on IIf for each colour variation and with one of the results being Null for each field

Make a text box for each field, set the font for colour/bold etc. and with the exception of one of the boxes set the background to transparent, overlay them with the box that has background colour on the bottom.
 
I went to the form conditional format thing and it doesn't have anything about my situation. It had a lot but I couldn't figure it out.

All I know is that this will only change the value and not the backcolor:

select case me.description
case "Print Not Available"
me!description.backcolor = vbblack
me!description = "worked"
end select

that will change the field to "worked" but not the backcolor to black
 
I don't think that'd help me any because I would like to expand it to bold the font and change the font color
 

Users who are viewing this thread

Back
Top Bottom