Reputation: 116
I have an unbound form with 300+ controls on it that pulls data from line items on an order (via a reccordset) and does calculations to count different products. It's possible to have multiple products with a width of 1, 2, 3, etc counted on this form, it is then programmed in VBA to set the background color of changed values to vbGreen when setting the textbox values so that the user can easily see what has changed.
My boxes are being filled with values however the green background is only showing when you click in the box
If Double20 <> 0 Then
Me.Double20.Value = Double20
Me.Double20.BackColor = VbGreen
End If
Double20 is the variable holding the count (and yes I did try changing the variable name to check for conflicts)
Any Ideas?
Edit: I also tried referring to it explicitly
Forms![DWO Creator Form]![Double20].BackColor = vbRed
and that changes it to red (but only after clicking in it)
Upvotes: 0
Views: 2673
Reputation: 27644
All your textboxes have a transparent background.
You either need to set it to "Normal" in design view, or add
Me.Double20.BackStyle = 1
when setting the .BackColor
.
In retrospect, this should have been obvious - controls showing their backcolor only when they have the focus is exactly the behavior of a transparent background...
Upvotes: 4