View Full Version : Set color based on field value automatically


agust
04-18-2007, 01:58 AM
Is it possible (VBA programmatically) to set color automatically on each textbox in a continuous form based on field value? It means the fields / textboxes on the same column will have different colors based on their different values on different rows/records.

RoyVidar
04-18-2007, 02:03 AM
As far as I know, no

Use conditional formatting from the format menu in stead (this can be done programatically)

The reason, is that what you see, isn't multiple controls, but multiple instances of the same control - do a change to one control programatically, you change all instances of it.

mattloflin
01-04-2008, 12:43 PM
what if you are going to have more than 3 conditional formats? for instance I have to change the back color based off of the text within the cell.

if the [Description] = "No Print Available" the backcolor needs to be Tan but i'mnew to the vb side of conditional formatting and this:

If Me!Description.Value = "Print Not Available" Then
Me!Description.BackColor = &H78BCBC
End If

returns saying that there is no value.

I have attached my database and it's under the rptCurrent